(svn r4551) - NewGRF: add string handling for newstations.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user