Codechange: Store grfid with entity grfprops.

This allows using the grfid without having to dereference the grffile pointer.

Uses no extra storage as it fits within otherwise wasted padding space.
This commit is contained in:
Peter Nelson
2024-11-23 14:05:42 +00:00
committed by Peter Nelson
parent e750d10cee
commit e73d6fcaac
24 changed files with 132 additions and 112 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ void MoveWaypointsToBaseStations()
* from the GRF ID / station index. */
for (OldWaypoint &wp : _old_waypoints) {
const auto specs = StationClass::Get(STAT_CLASS_WAYP)->Specs();
auto found = std::ranges::find_if(specs, [&wp](const StationSpec *spec) { return spec != nullptr && spec->grf_prop.grffile->grfid == wp.grfid && spec->grf_prop.local_id == wp.localidx; });
auto found = std::ranges::find_if(specs, [&wp](const StationSpec *spec) { return spec != nullptr && spec->grf_prop.grfid == wp.grfid && spec->grf_prop.local_id == wp.localidx; });
if (found != std::end(specs)) wp.spec = *found;
}
}