From 5fcd71cf288b382fabf75d878c48711a4710df39 Mon Sep 17 00:00:00 2001 From: darkvater Date: Sun, 14 Nov 2004 16:11:48 +0000 Subject: (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). --- station_cmd.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'station_cmd.c') 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) -- cgit v1.2.3-54-g00ecf