summaryrefslogtreecommitdiff
path: root/src/newgrf_station.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-02-22 22:09:51 +0000
committerpeter1138 <peter1138@openttd.org>2007-02-22 22:09:51 +0000
commit60620049606d5ce556d26ddaf401fcf5f28f1954 (patch)
tree432cebbeb0022164d562965a95d0ae34877f212e /src/newgrf_station.cpp
parent4f41a8a5e29795e52f999089cd11b3b5a149443d (diff)
downloadopenttd-60620049606d5ce556d26ddaf401fcf5f28f1954.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.cpp16
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;
}
}