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/newgrf.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/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7b5a47f3f..0d5e2507a 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3658,9 +3658,10 @@ static void CalculateRefitMasks(void) if (cargo_allowed[engine] != 0) { // Build up the list of cargo types from the set cargo classes. - for (i = 0; i < lengthof(cargo_classes); i++) { - if (HASBIT(cargo_allowed[engine], i)) mask |= cargo_classes[i]; - if (HASBIT(cargo_disallowed[engine], i)) not_mask |= cargo_classes[i]; + for (i = 0; i < NUM_CARGO; i++) { + const CargoSpec *cs = GetCargo(i); + if (cargo_allowed[engine] & cs->classes) SETBIT(mask, cs->bitnum); + if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, cs->bitnum); } } else { // Don't apply default refit mask to wagons or engines with no capacity @@ -3673,7 +3674,7 @@ static void CalculateRefitMasks(void) xor_mask = _default_refitmasks[GetEngine(engine)->type]; } } - _engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _landscape_global_cargo_mask[_opt.landscape]; + _engine_info[engine].refit_mask = ((mask & ~not_mask) ^ xor_mask) & _cargo_mask; } } |