Changeset - r27068:c4b5c7c37553
[Not reviewed]
master
0 1 0
PeterN - 20 months ago 2023-04-10 18:23:18
peter1138@openttd.org
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.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -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);
0 comments (0 inline, 0 general)