From 60620049606d5ce556d26ddaf401fcf5f28f1954 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 22 Feb 2007 22:09:51 +0000 Subject: (svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions. --- src/newgrf.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/newgrf.cpp') 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; } } -- cgit v1.2.3-54-g00ecf