mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add station/roadstop class labels for DFLT/WAYP.
This avoids repeating the same multichar literal value.pull/12653/head
parent
d5671030b1
commit
9f8c9724be
|
@ -31,10 +31,10 @@ template <>
|
||||||
void RoadStopClass::InsertDefaults()
|
void RoadStopClass::InsertDefaults()
|
||||||
{
|
{
|
||||||
/* Set up initial data */
|
/* Set up initial data */
|
||||||
RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->name = STR_STATION_CLASS_DFLT;
|
RoadStopClass::Get(RoadStopClass::Allocate(ROADSTOP_CLASS_LABEL_DEFAULT))->name = STR_STATION_CLASS_DFLT;
|
||||||
RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->Insert(nullptr);
|
RoadStopClass::Get(RoadStopClass::Allocate(ROADSTOP_CLASS_LABEL_DEFAULT))->Insert(nullptr);
|
||||||
RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->name = STR_STATION_CLASS_WAYP;
|
RoadStopClass::Get(RoadStopClass::Allocate(ROADSTOP_CLASS_LABEL_WAYPOINT))->name = STR_STATION_CLASS_WAYP;
|
||||||
RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->Insert(nullptr);
|
RoadStopClass::Get(RoadStopClass::Allocate(ROADSTOP_CLASS_LABEL_WAYPOINT))->Insert(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
/** The maximum amount of roadstops a single GRF is allowed to add */
|
/** The maximum amount of roadstops a single GRF is allowed to add */
|
||||||
static const int NUM_ROADSTOPS_PER_GRF = UINT16_MAX - 1;
|
static const int NUM_ROADSTOPS_PER_GRF = UINT16_MAX - 1;
|
||||||
|
|
||||||
|
static const uint32_t ROADSTOP_CLASS_LABEL_DEFAULT = 'DFLT';
|
||||||
|
static const uint32_t ROADSTOP_CLASS_LABEL_WAYPOINT = 'WAYP';
|
||||||
|
|
||||||
enum RoadStopClassID : uint16_t {
|
enum RoadStopClassID : uint16_t {
|
||||||
ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value
|
ROADSTOP_CLASS_BEGIN = 0, ///< The lowest valid value
|
||||||
ROADSTOP_CLASS_DFLT = 0, ///< Default road stop class.
|
ROADSTOP_CLASS_DFLT = 0, ///< Default road stop class.
|
||||||
|
|
|
@ -32,10 +32,10 @@ template <>
|
||||||
/* static */ void StationClass::InsertDefaults()
|
/* static */ void StationClass::InsertDefaults()
|
||||||
{
|
{
|
||||||
/* Set up initial data */
|
/* Set up initial data */
|
||||||
StationClass::Get(StationClass::Allocate('DFLT'))->name = STR_STATION_CLASS_DFLT;
|
StationClass::Get(StationClass::Allocate(STATION_CLASS_LABEL_DEFAULT))->name = STR_STATION_CLASS_DFLT;
|
||||||
StationClass::Get(StationClass::Allocate('DFLT'))->Insert(nullptr);
|
StationClass::Get(StationClass::Allocate(STATION_CLASS_LABEL_DEFAULT))->Insert(nullptr);
|
||||||
StationClass::Get(StationClass::Allocate('WAYP'))->name = STR_STATION_CLASS_WAYP;
|
StationClass::Get(StationClass::Allocate(STATION_CLASS_LABEL_WAYPOINT))->name = STR_STATION_CLASS_WAYP;
|
||||||
StationClass::Get(StationClass::Allocate('WAYP'))->Insert(nullptr);
|
StationClass::Get(StationClass::Allocate(STATION_CLASS_LABEL_WAYPOINT))->Insert(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -79,6 +79,9 @@ struct StationResolverObject : public ResolverObject {
|
||||||
uint32_t GetDebugID() const override;
|
uint32_t GetDebugID() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint32_t STATION_CLASS_LABEL_DEFAULT = 'DFLT';
|
||||||
|
static const uint32_t STATION_CLASS_LABEL_WAYPOINT = 'WAYP';
|
||||||
|
|
||||||
enum StationClassID : uint16_t {
|
enum StationClassID : uint16_t {
|
||||||
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
|
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
|
||||||
STAT_CLASS_DFLT = 0, ///< Default station class.
|
STAT_CLASS_DFLT = 0, ///< Default station class.
|
||||||
|
|
Loading…
Reference in New Issue