diff options
author | tron <tron@openttd.org> | 2004-11-15 20:52:11 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2004-11-15 20:52:11 +0000 |
commit | b65bda506c8199ab2e5e83cb93626ade806a6e60 (patch) | |
tree | 8b3f2d93253ce49b0edbcf70e33d4c79e2729ac5 /station_cmd.c | |
parent | 61103119fbf35f3d83ad42aa952dca9a858b358f (diff) | |
download | openttd-b65bda506c8199ab2e5e83cb93626ade806a6e60.tar.xz |
(svn r635) Fix choosing a spritegroup from deterministic variational spritegroups if there is no structure to search (i.e. in purchase lists) (pasky)
Diffstat (limited to 'station_cmd.c')
-rw-r--r-- | station_cmd.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/station_cmd.c b/station_cmd.c index bb110011b..d6d707e17 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1023,6 +1023,19 @@ ResolveStationSpriteGroup(struct SpriteGroup *spritegroup, struct Station *stat) value = GetDeterministicSpriteValue(dsg->variable); } else { + if (stat == NULL) { + /* We are in a build dialog of something, + * and we are checking for something undefined. + * That means we should get the first target + * (NOT the default one). */ + if (dsg->num_ranges > 0) { + target = &dsg->ranges[0].group; + } else { + target = dsg->default_group; + } + return ResolveStationSpriteGroup(target, NULL); + } + /* Station-specific property. */ if (dsg->var_scope == VSG_SCOPE_PARENT) { /* TODO: Town structure. */ @@ -1039,25 +1052,25 @@ ResolveStationSpriteGroup(struct SpriteGroup *spritegroup, struct Station *stat) // Variable is 0x70 + offset in the TTD's station structure switch (dsg->variable - 0x70) { case 0x80: - if (stat) value = stat->facilities; + value = stat->facilities; break; case 0x81: - if (stat) value = stat->airport_type; + value = stat->airport_type; break; case 0x82: - if (stat) value = stat->truck_stop_status; + value = stat->truck_stop_status; break; case 0x83: - if (stat) value = stat->bus_stop_status; + value = stat->bus_stop_status; break; case 0x86: - if (stat) value = stat->airport_flags & 0xFFFF; + value = stat->airport_flags & 0xFFFF; break; case 0x87: - if (stat) value = stat->airport_flags & 0xFF; + value = stat->airport_flags & 0xFF; break; case 0x8A: - if (stat) value = stat->build_date; + value = stat->build_date; break; } } |