diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-20 17:04:08 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-20 17:04:08 +0000 |
commit | fe6dadad7bca7a772fe5626c59b44b243324e6f5 (patch) | |
tree | 2b85744b60fcd7085bb5bb2052610cd2f8a17edf | |
parent | 9ed8c6d4acea5c41246d3fa54301d4a0cc814985 (diff) | |
download | openttd-fe6dadad7bca7a772fe5626c59b44b243324e6f5.tar.xz |
(svn r4484) - Newstations: Use StringIDs instead of char*s to reference our custom names.
-rw-r--r-- | lang/english.txt | 3 | ||||
-rw-r--r-- | newgrf_station.c | 10 | ||||
-rw-r--r-- | newgrf_station.h | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lang/english.txt b/lang/english.txt index 67fa61a78..84e91ef63 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1711,6 +1711,9 @@ STR_306B_HELIPORT :{BLACK}Heliport STR_306C_STATION_TOO_SPREAD_OUT :{WHITE}...station too spread out STR_306D_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}...nonuniform stations disabled +STR_STAT_CLASS_DFLT :Default station +STR_STAT_CLASS_WAYP :Waypoints + ##id 0x3800 STR_3800_SHIP_DEPOT_ORIENTATION :{WHITE}Ship Depot Orientation STR_3801_MUST_BE_BUILT_ON_WATER :{WHITE}...must be built on water diff --git a/newgrf_station.c b/newgrf_station.c index ce336c6ae..4151fcae3 100644 --- a/newgrf_station.c +++ b/newgrf_station.c @@ -6,6 +6,7 @@ #include "openttd.h" #include "debug.h" #include "sprite.h" +#include "table/strings.h" #include "station.h" #include "station_map.h" #include "newgrf_station.h" @@ -22,10 +23,7 @@ void ResetStationClasses(void) StationClassID i; for (i = 0; i < STAT_CLASS_MAX; i++) { station_classes[i].id = 0; - - free(station_classes[i].name); - station_classes[i].name = NULL; - + station_classes[i].name = STR_EMPTY; station_classes[i].stations = 0; free(station_classes[i].spec); @@ -34,13 +32,13 @@ void ResetStationClasses(void) // Set up initial data station_classes[0].id = 'DFLT'; - station_classes[0].name = strdup("Default"); + station_classes[0].name = STR_STAT_CLASS_DFLT; station_classes[0].stations = 1; station_classes[0].spec = malloc(sizeof(*station_classes[0].spec)); station_classes[0].spec[0] = NULL; station_classes[1].id = 'WAYP'; - station_classes[1].name = strdup("Waypoints"); + station_classes[1].name = STR_STAT_CLASS_WAYP; station_classes[1].stations = 1; station_classes[1].spec = malloc(sizeof(*station_classes[1].spec)); station_classes[1].spec[0] = NULL; diff --git a/newgrf_station.h b/newgrf_station.h index 2d9123b3b..5f6c630ef 100644 --- a/newgrf_station.h +++ b/newgrf_station.h @@ -22,6 +22,7 @@ typedef struct stationspec { int localidx; ///< Index within GRF file of station. StationClassID sclass; ///< The class to which this spec belongs. + StringID name; ///< Name of this station. /** * Bitmask of number of platforms available for the station. @@ -76,14 +77,13 @@ typedef struct stationspec { */ typedef struct stationclass { uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc. - char *name; ///< Name of this class. + StringID name; ///< Name of this class. uint stations; ///< Number of stations in this class. StationSpec **spec; ///< Array of station specifications. } StationClass; void ResetStationClasses(void); StationClassID AllocateStationClass(uint32 class); -void SetStationClassName(StationClassID sclass, const char *name); uint GetNumStationClasses(void); uint GetNumCustomStations(StationClassID sclass); |