diff options
author | frosch <frosch@openttd.org> | 2008-07-27 12:35:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-07-27 12:35:14 +0000 |
commit | 80725edc3da3b3f30fdad9a71e69ec6b461ba6c0 (patch) | |
tree | ba53ed2e827afe118bd9021ab2b2b54cfe4fbb2d /src | |
parent | 2cec059248b7f81d352c9e07e65fe1414fdc026d (diff) | |
download | openttd-80725edc3da3b3f30fdad9a71e69ec6b461ba6c0.tar.xz |
(svn r13847) -Codechange: Add MAX_ARTICULATED_PARTS and set it to 100.
Diffstat (limited to 'src')
-rw-r--r-- | src/articulated_vehicles.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp index 1a38a4e44..74b21a3b5 100644 --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -11,6 +11,8 @@ #include "newgrf_engine.h" #include "vehicle_func.h" +static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback. + uint CountArticulatedParts(EngineID engine_type, bool purchase_window) { if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0; @@ -22,7 +24,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window) } uint i; - for (i = 1; i < MAX_UVALUE(EngineID); i++) { + for (i = 1; i < MAX_ARTICULATED_PARTS; i++) { uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine_type, v); if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break; } @@ -49,7 +51,7 @@ uint16 *GetCapacityOfArticulatedParts(EngineID engine, VehicleType type) if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity; - for (uint i = 1; i < MAX_UVALUE(EngineID); i++) { + for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) { uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, engine, NULL); if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) break; @@ -75,7 +77,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type) if (!HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return; - for (uint i = 1; i < MAX_UVALUE(EngineID); i++) { + for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) { uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, v->engine_type, v); if (callback == CALLBACK_FAILED || GB(callback, 0, 8) == 0xFF) return; |