Fix 3ac1a2f1e4: Game crash due to invalid vehicle type information. (#14628)
Use std::variant instead of union for vehicle info. RailVehicleInfo is now non-POD so using in a union causes undefined behaviour.
This commit is contained in:
@@ -145,7 +145,7 @@ class ReplaceVehicleWindow : public Window {
|
||||
case VEH_ROAD:
|
||||
if (draw_left && this->sel_roadtype != INVALID_ROADTYPE) {
|
||||
/* Ensure that the roadtype is specific to the selected one */
|
||||
if (e->u.road.roadtype != this->sel_roadtype) continue;
|
||||
if (e->VehInfo<RoadVehicleInfo>().roadtype != this->sel_roadtype) continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user