(svn r4551) - NewGRF: add string handling for newstations.

This commit is contained in:
peter1138
2006-04-23 18:37:06 +00:00
parent 87e994c25b
commit b4ba26bce7
3 changed files with 49 additions and 6 deletions

View File

@@ -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.