(svn r4484) - Newstations: Use StringIDs instead of char*s to reference our custom names.

This commit is contained in:
peter1138 2006-04-20 17:04:08 +00:00
parent 9ed8c6d4ac
commit fe6dadad7b
3 changed files with 9 additions and 8 deletions

View File

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

View File

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

View File

@ -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);