diff options
Diffstat (limited to 'newgrf_station.c')
-rw-r--r-- | newgrf_station.c | 33 |
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. |