diff options
author | peter1138 <peter1138@openttd.org> | 2005-11-12 00:19:34 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2005-11-12 00:19:34 +0000 |
commit | 12009af1c5fd83a24451155a283fe97926568be8 (patch) | |
tree | e5f727d749b6f788bedbdaeef17fab347dbfefbb /station_cmd.c | |
parent | ce9f2fe82364224d8081f5a5ac43e19152e33500 (diff) | |
download | openttd-12009af1c5fd83a24451155a283fe97926568be8.tar.xz |
(svn r3167) - NewGRF: Start moving custom station code to separate files.
Rewrite handling of station classes.
Allow for more than 8 station tile layouts.
Start of code to unload custom stations.
Diffstat (limited to 'station_cmd.c')
-rw-r--r-- | station_cmd.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/station_cmd.c b/station_cmd.c index f46bd19a6..b0c88412c 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1199,60 +1199,6 @@ uint GetStationPlatforms(const Station *st, TileIndex tile) return len - 1; } - -/* TODO: Custom classes! */ -/* Indexed by class, just STAT_CLASS_DFLT and STAT_CLASS_WAYP supported. */ -static int _statspec_highest_id[2] = {-1, -1}; -static StationSpec _station_spec[2][256]; - -void SetCustomStation(byte local_stid, StationSpec *spec) -{ - StationClass sclass; - int stid = -1; - - assert(spec->sclass == STAT_CLASS_DFLT || spec->sclass == STAT_CLASS_WAYP); - sclass = spec->sclass - 1; - - if (spec->localidx != 0) { - /* Already allocated, try to resolve to global stid */ - int i; - - for (i = 0; i <= _statspec_highest_id[sclass]; i++) { - if (_station_spec[sclass][i].grfid == spec->grfid && - _station_spec[sclass][i].localidx == local_stid + 1) { - stid = i; - /* FIXME: Release original SpriteGroup to - * prevent leaks. But first we need to - * refcount the SpriteGroup. --pasky */ - break; - } - } - } - - if (stid == -1) { - /* Allocate new one. */ - if (_statspec_highest_id[sclass] >= 255) { - error("Too many custom stations allocated."); - return; - } - stid = ++_statspec_highest_id[sclass]; - spec->localidx = local_stid + 1; - } - - //debug("Registering station #%d of class %d", stid, sclass); - memcpy(&_station_spec[sclass][stid], spec, sizeof(*spec)); -} - -StationSpec *GetCustomStation(StationClass sclass, byte stid) -{ - assert(sclass == STAT_CLASS_DFLT || sclass == STAT_CLASS_WAYP); - sclass--; - //debug("Asking for station #%d of class %d", stid, sclass); - if (stid > _statspec_highest_id[sclass]) - return NULL; - return &_station_spec[sclass][stid]; -} - static const RealSpriteGroup *ResolveStationSpriteGroup(const SpriteGroup *spg, const Station *st) { switch (spg->type) { @@ -1351,14 +1297,6 @@ uint32 GetCustomStationRelocation(const StationSpec *spec, const Station *st, by return SPR_RAIL_PLATFORM_Y_FRONT; } -int GetCustomStationsCount(StationClass sclass) -{ - assert(sclass == STAT_CLASS_DFLT || sclass == STAT_CLASS_WAYP); - sclass--; - return _statspec_highest_id[sclass] + 1; -} - - static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) { int w,h; |