mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-26 21:54:22 +01:00
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:
@@ -1138,7 +1138,7 @@ static void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, En
|
||||
|
||||
/* Only valid for helicopters */
|
||||
assert(e->type == VEH_AIRCRAFT);
|
||||
assert(!(e->u.air.subtype & AIR_CTOL));
|
||||
assert(!(e->VehInfo<AircraftVehicleInfo>().subtype & AIR_CTOL));
|
||||
|
||||
/* We differ from TTDPatch by resolving the sprite using the primary vehicle 'v', and not using the rotor vehicle 'v->Next()->Next()'.
|
||||
* TTDPatch copies some variables between the vehicles each time, to somehow synchronize the rotor vehicle with the primary vehicle.
|
||||
|
||||
Reference in New Issue
Block a user