summaryrefslogtreecommitdiff
path: root/newgrf_station.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-23 18:37:06 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-23 18:37:06 +0000
commit70bd867d7134c6eb44cdca80275d3015bb7807c3 (patch)
treee57b71a10c177e0c31af9cf1b413ab924f5d04e2 /newgrf_station.c
parentbaebc8d47e33e0c0a9a5cd3943afabeafabc19d9 (diff)
downloadopenttd-70bd867d7134c6eb44cdca80275d3015bb7807c3.tar.xz
(svn r4551) - NewGRF: add string handling for newstations.
Diffstat (limited to 'newgrf_station.c')
-rw-r--r--newgrf_station.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index 4151fcae3..f47820cb5 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -68,6 +68,39 @@ StationClassID AllocateStationClass(uint32 class)
return STAT_CLASS_DFLT;
}
+/** Set the name of a custom station class */
+void SetStationClassName(StationClassID sclass, StringID name)
+{
+ assert(sclass < STAT_CLASS_MAX);
+ station_classes[sclass].name = name;
+}
+
+/** Retrieve the name of a custom station class */
+StringID GetStationClassName(StationClassID sclass)
+{
+ assert(sclass < STAT_CLASS_MAX);
+ return station_classes[sclass].name;
+}
+
+/** Build a list of station class name StringIDs to use in a dropdown list
+ * @return Pointer to a (static) array of StringIDs
+ */
+StringID *BuildStationClassDropdown(void)
+{
+ /* Allow room for all station classes, plus a terminator entry */
+ static StringID names[STAT_CLASS_MAX + 1];
+ uint i;
+
+ /* Add each name */
+ for (i = 0; i < STAT_CLASS_MAX && station_classes[i].id != 0; i++) {
+ names[i] = station_classes[i].name;
+ }
+ /* Terminate the list */
+ names[i] = INVALID_STRING_ID;
+
+ return names;
+}
+
/**
* Get the number of station classes in use.
* @return Number of station classes.