diff options
author | peter1138 <peter1138@openttd.org> | 2007-02-22 22:09:51 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-02-22 22:09:51 +0000 |
commit | 2306a02f75f53e673ea9e113e7edea794b3b088a (patch) | |
tree | 432cebbeb0022164d562965a95d0ae34877f212e /src/newgrf_station.cpp | |
parent | 11f286fb74536250db767faaf6ae373b5f8349b3 (diff) | |
download | openttd-2306a02f75f53e673ea9e113e7edea794b3b088a.tar.xz |
(svn r8849) -Codechange: Replace hardcoded global/climate cargo mapping tables with dynamically generated data. Change associated code to use new functions.
Diffstat (limited to 'src/newgrf_station.cpp')
-rw-r--r-- | src/newgrf_station.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 9c39bc04e..a26de5e3d 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -18,6 +18,7 @@ #include "newgrf_spritegroup.h" #include "date.h" #include "helpers.hpp" +#include "cargotype.h" static StationClass station_classes[STAT_CLASS_MAX]; @@ -459,7 +460,7 @@ static const SpriteGroup *StationResolveReal(const ResolverObject *object, const break; default: - cargo = GB(st->goods[_local_cargo_id_ctype[cargo_type]].waiting_acceptance, 0, 12); + cargo = GB(st->goods[GetCargoIDByBitnum(cargo_type)].waiting_acceptance, 0, 12); break; } @@ -511,15 +512,12 @@ static const SpriteGroup *ResolveStation(ResolverObject *object) /* No station, so we are in a purchase list */ ctype = GC_PURCHASE; } else { - CargoID cargo; - /* Pick the first cargo that we have waiting */ - for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { - CargoID lcid = _local_cargo_id_ctype[cargo]; - if (lcid != CT_INVALID && - object->u.station.statspec->spritegroup[cargo] != NULL && - GB(object->u.station.st->goods[lcid].waiting_acceptance, 0, 12) != 0) { - ctype = cargo; + for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) { + const CargoSpec *cs = GetCargo(cargo); + if (cs->bitnum != 0xFF && object->u.station.statspec->spritegroup[cs->bitnum] != NULL && + GB(object->u.station.st->goods[cargo].waiting_acceptance, 0, 12) != 0) { + ctype = cs->bitnum; break; } } |