1
0
Fork 0

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.
pull/10922/head
PeterN 2023-04-10 19:23:18 +01:00 committed by Loïc Guilloux
parent 7f987c8d3a
commit f4f35a1f5c
1 changed files with 2 additions and 0 deletions

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);