diff options
author | peter1138 <peter1138@openttd.org> | 2007-02-22 22:09:51 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-02-22 22:09:51 +0000 |
commit | 60620049606d5ce556d26ddaf401fcf5f28f1954 (patch) | |
tree | 432cebbeb0022164d562965a95d0ae34877f212e /src/vehicle.cpp | |
parent | 4f41a8a5e29795e52f999089cd11b3b5a149443d (diff) | |
download | openttd-60620049606d5ce556d26ddaf401fcf5f28f1954.tar.xz |
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 1e4ed0dcc..7668c3a3a 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -37,6 +37,7 @@ #include "newgrf_engine.h" #include "newgrf_sound.h" #include "helpers.hpp" +#include "cargotype.h" #define INVALID_COORD (-0x8000) #define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6)) @@ -761,7 +762,7 @@ bool CanFillVehicle(Vehicle *v) */ bool CanRefitTo(EngineID engine_type, CargoID cid_to) { - CargoID cid = _global_cargo_id[_opt_ptr->landscape][cid_to]; + CargoID cid = GetCargo(cid_to)->bitnum; return HASBIT(EngInfo(engine_type)->refit_mask, cid); } @@ -771,12 +772,11 @@ bool CanRefitTo(EngineID engine_type, CargoID cid_to) */ CargoID FindFirstRefittableCargo(EngineID engine_type) { - CargoID cid; uint32 refit_mask = EngInfo(engine_type)->refit_mask; if (refit_mask != 0) { - for (cid = CT_PASSENGERS; cid < NUM_CARGO; cid++) { - if (HASBIT(refit_mask, _global_cargo_id[_opt_ptr->landscape][cid])) return cid; + for (CargoID cid = CT_PASSENGERS; cid < NUM_CARGO; cid++) { + if (HASBIT(refit_mask, GetCargo(cid)->bitnum)) return cid; } } |