summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2004-11-14 09:07:15 +0000
committercelestar <celestar@openttd.org>2004-11-14 09:07:15 +0000
commiteb50427670871854931383f8bf331ddaea3ebc45 (patch)
tree42723b432782d90b954356a8da01ddcb5f40da1d /station_cmd.c
parenta9a852a4d61465ba33113239a9264ec39ef4c652 (diff)
downloadopenttd-eb50427670871854931383f8bf331ddaea3ebc45.tar.xz
(svn r581) -newgrf: Basic support for new stations - only waypoints supported now and only
the first custom one can be placed (no selector GUI, coming soon). This also moves some global variables to {struct GRFFile} and reorders which actions are processed in what stage, to get it all working together -- (pasky)
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/station_cmd.c b/station_cmd.c
index c28c2587e..8e0b99ae6 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -957,6 +957,38 @@ uint GetStationPlatforms(Station *st, uint tile)
}
+/* TODO: Multiple classes! */
+/* FIXME: Also, we should actually allocate the station id (but
+ * SetCustomStation() needs to be able to override an existing custom station
+ * as well) on our own. This would also prevent possible weirdness if some GRF
+ * file used non-contignuous station ids. --pasky */
+
+static int _waypoint_highest_id = -1;
+static DrawTileSprites _waypoint_data[256][8];
+
+void SetCustomStation(uint32 classid, byte stid, DrawTileSprites *data, byte tiles)
+{
+ assert(classid == 'WAYP');
+ if (stid > _waypoint_highest_id)
+ _waypoint_highest_id = stid;
+ memcpy(_waypoint_data[stid], data, sizeof(DrawTileSprites) * tiles);
+}
+
+DrawTileSprites *GetCustomStation(uint32 classid, byte stid)
+{
+ assert(classid == 'WAYP');
+ if (stid > _waypoint_highest_id || !_waypoint_data || !_waypoint_data[stid])
+ return NULL;
+ return _waypoint_data[stid];
+}
+
+int GetCustomStationsCount(uint32 classid)
+{
+ assert(classid == 'WAYP');
+ return _waypoint_highest_id + 1;
+}
+
+
static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
{
int w,h;