From bc6a4b1d08aa403f797c4996c886bbc056dc84f7 Mon Sep 17 00:00:00 2001 From: PeterN Date: Mon, 8 May 2023 16:42:01 +0100 Subject: [PATCH] Fix: Set up default station/waypoint classes properly. (#10789) --- src/newgrf_roadstop.cpp | 11 ++++------- src/newgrf_station.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index bafd66a529..a03ff256ee 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -31,13 +31,10 @@ template void NewGRFClass::InsertDefaults() { /* Set up initial data */ - classes[0].global_id = 'DFLT'; - classes[0].name = STR_STATION_CLASS_DFLT; - classes[0].Insert(nullptr); - - classes[1].global_id = 'WAYP'; - classes[1].name = STR_STATION_CLASS_WAYP; - classes[1].Insert(nullptr); + RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->name = STR_STATION_CLASS_DFLT; + RoadStopClass::Get(RoadStopClass::Allocate('DFLT'))->Insert(nullptr); + RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->name = STR_STATION_CLASS_WAYP; + RoadStopClass::Get(RoadStopClass::Allocate('WAYP'))->Insert(nullptr); } template diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 9dc117d5b8..9d43bd857c 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -32,13 +32,10 @@ template /* static */ void NewGRFClass::InsertDefaults() { /* Set up initial data */ - classes[0].global_id = 'DFLT'; - classes[0].name = STR_STATION_CLASS_DFLT; - classes[0].Insert(nullptr); - - classes[1].global_id = 'WAYP'; - classes[1].name = STR_STATION_CLASS_WAYP; - classes[1].Insert(nullptr); + StationClass::Get(StationClass::Allocate('DFLT'))->name = STR_STATION_CLASS_DFLT; + StationClass::Get(StationClass::Allocate('DFLT'))->Insert(nullptr); + StationClass::Get(StationClass::Allocate('WAYP'))->name = STR_STATION_CLASS_WAYP; + StationClass::Get(StationClass::Allocate('WAYP'))->Insert(nullptr); } template