Codechange: Add NewGRFSpecsBase class to hold class/index information.
Standardises how the class index is stored in the spec, instead of relying ot the Spec structs having the same members. This allows retrieving class_index and index without searching or using pointer arithmetic. 'cls_id' is renamed to 'class_index' to make it clearer that it is an index rather than the multichar label of the class.
This commit is contained in:
committed by
Peter Nelson
parent
733284cc16
commit
d5671030b1
@@ -114,11 +114,11 @@ void AfterLoadStations()
|
||||
for (BaseStation *st : BaseStation::Iterate()) {
|
||||
for (auto &sm : GetStationSpecList<StationSpec>(st)) {
|
||||
if (sm.grfid == 0) continue;
|
||||
sm.spec = StationClass::GetByGrf(sm.grfid, sm.localidx, nullptr);
|
||||
sm.spec = StationClass::GetByGrf(sm.grfid, sm.localidx);
|
||||
}
|
||||
for (auto &sm : GetStationSpecList<RoadStopSpec>(st)) {
|
||||
if (sm.grfid == 0) continue;
|
||||
sm.spec = RoadStopClass::GetByGrf(sm.grfid, sm.localidx, nullptr);
|
||||
sm.spec = RoadStopClass::GetByGrf(sm.grfid, sm.localidx);
|
||||
}
|
||||
|
||||
if (Station::IsExpected(st)) {
|
||||
|
||||
Reference in New Issue
Block a user