summaryrefslogtreecommitdiff
path: root/newgrf_station.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-26 20:44:28 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-26 20:44:28 +0000
commit60cc7337e577eb676dff2f0d4fbf6ba394e3a3ff (patch)
tree71fddf3085e3ecae2d9fa11320b11d740ab8ab0d /newgrf_station.c
parent2c93d4719954a617b1ca15aa5a417c5481a68ff6 (diff)
downloadopenttd-60cc7337e577eb676dff2f0d4fbf6ba394e3a3ff.tar.xz
(svn r4583) - NewGRF: Revamp sprite group loading to support advanced varadjusts and variable size. These are not yet processed, however.
Diffstat (limited to 'newgrf_station.c')
-rw-r--r--newgrf_station.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index f47820cb5..c59aaf167 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -169,10 +169,11 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg,
const DeterministicSpriteGroup *dsg = &spg->g.determ;
SpriteGroup *target;
int value = -1;
+ byte variable = dsg->adjusts[0].variable;
- if ((dsg->variable >> 6) == 0) {
+ if ((variable >> 6) == 0) {
/* General property */
- value = GetDeterministicSpriteValue(dsg->variable);
+ value = GetDeterministicSpriteValue(variable);
} else {
if (st == NULL) {
/* We are in a build dialog of something,
@@ -192,7 +193,7 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg,
/* TODO: Town structure. */
} else /* VSG_SELF */ {
- if (dsg->variable == 0x40 || dsg->variable == 0x41) {
+ if (variable == 0x40 || variable == 0x41) {
/* FIXME: This is ad hoc only
* for waypoints. */
value = 0x01010000;
@@ -200,7 +201,7 @@ static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg,
/* TODO: Only small fraction done. */
// TTDPatch runs on little-endian arch;
// Variable is 0x70 + offset in the TTD's station structure
- switch (dsg->variable - 0x70) {
+ switch (variable - 0x70) {
case 0x80: value = st->facilities; break;
case 0x81: value = st->airport_type; break;
case 0x82: value = st->truck_stops->status; break;
@@ -229,10 +230,8 @@ uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, by
const RealSpriteGroup *rsg = ResolveStationSpriteGroup(spec->spritegroup[ctype], st);
if (rsg == NULL) return 0;
- if (rsg->sprites_per_set != 0) {
- if (rsg->loading_count != 0) return rsg->loading[0]->g.result.result;
- if (rsg->loaded_count != 0) return rsg->loaded[0]->g.result.result;
- }
+ if (rsg->num_loading != 0) return rsg->loading[0]->g.result.sprite;
+ if (rsg->num_loaded != 0) return rsg->loaded[0]->g.result.sprite;
DEBUG(grf, 6)("Custom station 0x%08x::0x%02x has no sprites associated.",
spec->grfid, spec->localidx);