1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-27 08:29:11 +00:00

Fix: Abort loading savegame if road vehicle is on invalid road type. (#10622)

This can happen if NewGRFs are missing so that engine or road type definitions are wrong.
This commit is contained in:
2023-04-10 19:23:18 +01:00
committed by Loïc Guilloux
parent 7f987c8d3a
commit f4f35a1f5c

View File

@@ -401,9 +401,11 @@ void AfterLoadVehicles(bool part_of_load)
rv->roadtype = Engine::Get(rv->engine_type)->u.road.roadtype;
rv->compatible_roadtypes = GetRoadTypeInfo(rv->roadtype)->powered_roadtypes;
RoadTramType rtt = GetRoadTramType(rv->roadtype);
for (RoadVehicle *u = rv; u != nullptr; u = u->Next()) {
u->roadtype = rv->roadtype;
u->compatible_roadtypes = rv->compatible_roadtypes;
if (GetRoadType(u->tile, rtt) == INVALID_ROADTYPE) SlErrorCorrupt("Road vehicle on invalid road type");
}
RoadVehUpdateCache(rv);