diff --git a/src/newgrf.cpp b/src/newgrf.cpp --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1506,7 +1506,7 @@ static ChangeInfoResult TownHouseChangeI * climate. This can cause problems when copying the properties * of a house that accepts food, where the new house is valid * in the temperate climate. */ - if (!GetCargo(housespec->accepts_cargo[2])->IsValid()) { + if (!CargoSpec::Get(housespec->accepts_cargo[2])->IsValid()) { housespec->cargo_acceptance[2] = 0; } @@ -1552,7 +1552,7 @@ static ChangeInfoResult TownHouseChangeI ((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD); /* Make sure the cargo type is valid in this climate. */ - if (!GetCargo(cid)->IsValid()) goods = 0; + if (!CargoSpec::Get(cid)->IsValid()) goods = 0; housespec->accepts_cargo[2] = cid; housespec->cargo_acceptance[2] = abs(goods); // but we do need positive value here @@ -1897,7 +1897,7 @@ static ChangeInfoResult CargoChangeInfo( } for (int i = 0; i < numinfo; i++) { - CargoSpec *cs = &_cargo[cid + i]; + CargoSpec *cs = CargoSpec::Get(cid + i); switch (prop) { case 0x08: // Bit number of cargo @@ -2995,7 +2995,7 @@ static CargoID TranslateCargo(uint8 feat } for (CargoID c = 0; c < NUM_CARGO; c++) { - const CargoSpec *cs = GetCargo(c); + const CargoSpec *cs = CargoSpec::Get(c); if (!cs->IsValid()) continue; if (cs->bitnum == ctype) { @@ -3290,7 +3290,7 @@ static void CargoMapSpriteGroup(byte *bu continue; } - CargoSpec *cs = &_cargo[cid]; + CargoSpec *cs = CargoSpec::Get(cid); cs->grffile = _cur_grffile; cs->group = _cur_grffile->spritegroups[groupid]; } @@ -5587,7 +5587,7 @@ static void BuildCargoTranslationMap() memset(_cur_grffile->cargo_map, 0xFF, sizeof(_cur_grffile->cargo_map)); for (CargoID c = 0; c < NUM_CARGO; c++) { - const CargoSpec *cs = GetCargo(c); + const CargoSpec *cs = CargoSpec::Get(c); if (!cs->IsValid()) continue; if (_cur_grffile->cargo_max == 0) { @@ -5699,7 +5699,7 @@ static void CalculateRefitMasks() } else { /* No cargo table, so use the cargo bitnum values */ for (CargoID c = 0; c < NUM_CARGO; c++) { - const CargoSpec *cs = GetCargo(c); + const CargoSpec *cs = CargoSpec::Get(c); if (!cs->IsValid()) continue; if (HasBit(ei->refit_mask, cs->bitnum)) SetBit(xor_mask, c); @@ -5710,7 +5710,7 @@ static void CalculateRefitMasks() if (_gted[engine].cargo_allowed != 0) { /* Build up the list of cargo types from the set cargo classes. */ for (CargoID i = 0; i < NUM_CARGO; i++) { - const CargoSpec *cs = GetCargo(i); + const CargoSpec *cs = CargoSpec::Get(i); if (_gted[engine].cargo_allowed & cs->classes) SetBit(mask, i); if (_gted[engine].cargo_disallowed & cs->classes) SetBit(not_mask, i); }