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:
+1
-1
@@ -229,7 +229,7 @@ void InitDepotWindowBlockSizes()
|
||||
if (!e->IsEnabled()) continue;
|
||||
|
||||
uint w = TRAININFO_DEFAULT_VEHICLE_WIDTH;
|
||||
if (e->GetGRF() != nullptr && IsCustomVehicleSpriteNum(e->u.rail.image_index)) {
|
||||
if (e->GetGRF() != nullptr && IsCustomVehicleSpriteNum(e->VehInfo<RailVehicleInfo>().image_index)) {
|
||||
w = e->GetGRF()->traininfo_vehicle_width;
|
||||
if (w != VEHICLEINFO_FULL_VEHICLE_WIDTH) {
|
||||
/* Hopeless.
|
||||
|
||||
Reference in New Issue
Block a user