(svn r8891) -Codechange: Remove remains of global cargo scheme. All cargo mapping is now dealt with only in NewGRF code, on load where possible.

This commit is contained in:
2007-02-24 23:36:40 +00:00
parent 29c8142784
commit 4c4b035175
9 changed files with 42 additions and 114 deletions

View File

@@ -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;