summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-11-14 16:11:48 +0000
committerdarkvater <darkvater@openttd.org>2004-11-14 16:11:48 +0000
commit5fcd71cf288b382fabf75d878c48711a4710df39 (patch)
treec0f556b7fdc43e1295404b32ceb7a4dadab0ac27 /station_cmd.c
parent2b5b1f4e0672696c73ea4d17679d31fbb80b929b (diff)
downloadopenttd-5fcd71cf288b382fabf75d878c48711a4710df39.tar.xz
(svn r600) -newgrf: Relocation offset for custom station sprites is now stored separately, making it possible to show different sprites in waypoint selection dialog (pasky).
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 8d8ce56ea..a0f1460d4 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -994,12 +994,33 @@ void SetCustomStation(byte local_stid, struct StationSpec *spec)
memcpy(&_waypoint_data[stid], spec, sizeof(*spec));
}
-DrawTileSprites *GetCustomStationRenderdata(uint32 classid, byte stid)
+struct StationSpec *GetCustomStation(uint32 classid, byte stid)
{
assert(classid == 'WAYP');
if (stid > _waypoint_highest_id)
return NULL;
- return _waypoint_data[stid].renderdata;
+ return &_waypoint_data[stid];
+}
+
+uint32 GetCustomStationRelocation(struct StationSpec *spec, byte ctype)
+{
+ assert(spec->classid == 'WAYP');
+
+ /* In the future, variational spritegroups will kick in through this
+ * accessor. */
+
+ if (spec->relocation[ctype].loading_count != 0) {
+ return spec->relocation[ctype].loading[0];
+ } else if (spec->relocation[ctype].loading_count != 0) {
+ return spec->relocation[ctype].loaded[0];
+ } else {
+ error("Custom station 0x%08x::0x%02x has no sprites associated.",
+ spec->grfid, spec->localidx);
+ /* This is what gets subscribed of dtss->image in grfspecial.c,
+ * so it's probably kinda "default offset". Try to use it as
+ * emergency measure. */
+ return 0x42D;
+ }
}
int GetCustomStationsCount(uint32 classid)