From 4c4b035175a6b8c23793bc3250c75bf50c4d72bd Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 24 Feb 2007 23:36:40 +0000 Subject: (svn r8891) -Codechange: Remove remains of global cargo scheme. All cargo mapping is now dealt with only in NewGRF code, on load where possible. --- src/cargotype.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/cargotype.cpp') diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 63253847b..be8403ee5 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -16,10 +16,7 @@ static CargoSpec _cargo[NUM_CARGO]; static const byte INVALID_CARGO = 0xFF; -/* Quick mapping from cargo type 'bitnums' to real cargo IDs */ -static CargoID _cargo_bitnum_map[32]; - -/* Bitmask of cargo type 'bitnums' availabe */ +/* Bitmask of cargo types available */ uint32 _cargo_mask; @@ -31,7 +28,6 @@ void SetupCargoForClimate(LandscapeID l) memset(_cargo, 0, sizeof(_cargo)); for (CargoID i = 0; i < lengthof(_cargo); i++) _cargo[i].bitnum = INVALID_CARGO; - memset(_cargo_bitnum_map, CT_INVALID, sizeof(_cargo_bitnum_map)); _cargo_mask = 0; for (CargoID i = 0; i < lengthof(_default_climate_cargo[l]); i++) { @@ -43,12 +39,8 @@ void SetupCargoForClimate(LandscapeID l) if (_default_cargo[j].label == cl) { _cargo[i] = _default_cargo[j]; - /* Populate the bitnum map and masks */ - byte bitnum = _cargo[i].bitnum; - if (bitnum < lengthof(_cargo_bitnum_map)) { - _cargo_bitnum_map[bitnum] = i; - SETBIT(_cargo_mask, bitnum); - } + /* Populate the available cargo mask */ + SETBIT(_cargo_mask, i); break; } } @@ -63,14 +55,6 @@ const CargoSpec *GetCargo(CargoID c) } -CargoID GetCargoIDByBitnum(byte bitnum) -{ - assert(bitnum < lengthof(_cargo_bitnum_map)); - assert(_cargo_bitnum_map[bitnum] != CT_INVALID); - return _cargo_bitnum_map[bitnum]; -} - - bool CargoSpec::IsValid() const { return bitnum != INVALID_CARGO; -- cgit v1.2.3-54-g00ecf