mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 23:07:38 +01:00
fix(sound): check for the player train in the outer noise test of a vehicle
The test whether a vehicle belongs to the player train dereferenced simulation::Train without a null check (commented out long ago). The driver mode switches to the free camera in the same frame the player train goes through a portal, before the sounds are updated, so it isn't known to crash, but nothing else guards it.
This commit is contained in:
@@ -4863,7 +4863,7 @@ void TDynamicObject::RenderSounds() {
|
||||
#endif
|
||||
&& ( // compound test whether the vehicle belongs to user-driven consist (as these don't emit outer noise in cab view)
|
||||
FreeFlyModeFlag ? true : // in external view all vehicles emit outer noise
|
||||
// Global.pWorld->train() == nullptr ? true : // (can skip this check, with no player train the external view is a given)
|
||||
simulation::Train == nullptr ? true : // no player train, e.g. it went through a portal and the view isn't switched yet
|
||||
ctOwner == nullptr ? true : // standalone vehicle, can't be part of user-driven train
|
||||
ctOwner != simulation::Train->Dynamic()->ctOwner ? true : // confirmed isn't a part of the user-driven train
|
||||
Global.CabWindowOpen ? true : // sticking head out we get to hear outer noise
|
||||
|
||||
Reference in New Issue
Block a user