summaryrefslogtreecommitdiff
path: root/src/cargotype.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-02-24 23:36:40 +0000
committerpeter1138 <peter1138@openttd.org>2007-02-24 23:36:40 +0000
commit4c4b035175a6b8c23793bc3250c75bf50c4d72bd (patch)
tree368b3cf550c0fcbbf2c814f0896d36aa12a8e28d /src/cargotype.cpp
parent29c81427842d282127c0e12789a156a1f833dcae (diff)
downloadopenttd-4c4b035175a6b8c23793bc3250c75bf50c4d72bd.tar.xz
(svn r8891) -Codechange: Remove remains of global cargo scheme. All cargo mapping is now dealt with only in NewGRF code, on load where possible.
Diffstat (limited to 'src/cargotype.cpp')
-rw-r--r--src/cargotype.cpp22
1 files changed, 3 insertions, 19 deletions
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;