summaryrefslogtreecommitdiff
path: root/src/articulated_vehicles.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-06-27 21:36:04 +0000
committerfrosch <frosch@openttd.org>2009-06-27 21:36:04 +0000
commit1e09854cb7484a0317de81d412c6a541a96dacb6 (patch)
tree5d8389a9efbf993b4e39c605d7aa0d5024b6d581 /src/articulated_vehicles.cpp
parenta288e4d82ff85819aa49061d66ee7e0cfd87e802 (diff)
downloadopenttd-1e09854cb7484a0317de81d412c6a541a96dacb6.tar.xz
(svn r16679) -Codechange: Let GetCapacityOfArticulatedParts() return a CargoArray instead of a pointer to a static array.
Diffstat (limited to 'src/articulated_vehicles.cpp')
-rw-r--r--src/articulated_vehicles.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index 15b4121d4..e325642f2 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -78,10 +78,9 @@ static inline uint32 GetAvailableVehicleCargoTypes(EngineID engine, VehicleType
return cargos;
}
-uint16 *GetCapacityOfArticulatedParts(EngineID engine, VehicleType type)
+CargoArray GetCapacityOfArticulatedParts(EngineID engine, VehicleType type)
{
- static uint16 capacity[NUM_CARGO];
- memset(capacity, 0, sizeof(capacity));
+ CargoArray capacity;
CargoID cargo_type;
uint16 cargo_capacity = GetVehicleDefaultCapacity(engine, type, &cargo_type);
@@ -239,12 +238,11 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
uint32 purchase_refit_union = GetUnionOfArticulatedRefitMasks(v->engine_type, v->type, true);
uint32 purchase_refit_intersection = GetIntersectionOfArticulatedRefitMasks(v->engine_type, v->type, true);
- uint16 *purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type, v->type);
+ CargoArray purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type, v->type);
uint32 real_refit_union = 0;
uint32 real_refit_intersection = UINT_MAX;
- uint16 real_default_capacity[NUM_CARGO];
- memset(real_default_capacity, 0, sizeof(real_default_capacity));
+ CargoArray real_default_capacity;
do {
uint32 refit_mask = GetAvailableVehicleCargoTypes(v->engine_type, v->type, true);