summaryrefslogtreecommitdiff
path: root/station.h
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-11-14 14:53:15 +0000
committerdarkvater <darkvater@openttd.org>2004-11-14 14:53:15 +0000
commit58473175266f453b900e4262588ccce075ec05c3 (patch)
tree548d0fcde9c3e1cc23af25dbd64d758bbf662231 /station.h
parentccc496ba2ce07be7bd8faf0a084e983dbed5e80b (diff)
downloadopenttd-58473175266f453b900e4262588ccce075ec05c3.tar.xz
(svn r592) -newgrf: Dynamically allocate global custom station IDs (pasky).
Diffstat (limited to 'station.h')
-rw-r--r--station.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/station.h b/station.h
index 73ac8f8f7..b8759e49f 100644
--- a/station.h
+++ b/station.h
@@ -110,13 +110,22 @@ typedef struct DrawTileSprites {
struct StationSpec {
- int globalidx;
+ uint32 grfid;
+ int localidx; // per-GRFFile station index + 1; SetCustomStation() takes care of this
+
uint32 classid;
+
byte tiles;
DrawTileSprites renderdata[8];
};
+/* Here, @stid is local per-GRFFile station index. If spec->localidx is not yet
+ * set, it gets new dynamically allocated global index and spec->localidx is
+ * set to @stid, otherwise we take it as that we are replacing it and try to
+ * search for it first (that isn't much fast but we do it only very seldom). */
void SetCustomStation(byte stid, struct StationSpec *spec);
+/* Here, @stid is global station index (in continous range 0..GetCustomStationsCount())
+ * (lookup is therefore very fast as we do this very frequently). */
DrawTileSprites *GetCustomStationRenderdata(uint32 classid, byte stid);
int GetCustomStationsCount(uint32 classid);