From 9551f3e977b43b5a128995017751b63e397cea3e Mon Sep 17 00:00:00 2001 From: Krzysztof Sobiecki Date: Tue, 21 May 2024 21:18:54 +0200 Subject: [PATCH] Clear Sky: Crash when some weapons(eg. wpn_val) with built in suppressor don't have snd_silncer_shot only snd_shoot --- src/xrGame/WeaponMagazined.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xrGame/WeaponMagazined.cpp b/src/xrGame/WeaponMagazined.cpp index a6bad977fab..bd99b7fd24e 100644 --- a/src/xrGame/WeaponMagazined.cpp +++ b/src/xrGame/WeaponMagazined.cpp @@ -98,7 +98,8 @@ void CWeaponMagazined::Load(LPCSTR section) m_sSilencerSmokeParticles = pSettings->r_string(section, "silencer_smoke_particles"); //Alundaio: LAYERED_SND_SHOOT Silencer - m_layered_sounds.LoadSound(section, "snd_silncer_shot", "sndSilencerShot", false, m_eSoundShot); + if (WeaponSoundExist(section, "snd_silncer_shot")) + m_layered_sounds.LoadSound(section, "snd_silncer_shot", "sndSilencerShot", false, m_eSoundShot); if (WeaponSoundExist(section, "snd_silncer_shot_actor")) m_layered_sounds.LoadSound(section, "snd_silncer_shot_actor", "sndSilencerShotActor", false, m_eSoundShot); //-Alundaio @@ -1065,7 +1066,9 @@ void CWeaponMagazined::InitAddons() } } - if (IsSilencerAttached() /* && SilencerAttachable() */) + if (IsSilencerAttached() && pSettings->line_exist(*cNameSect(), "silencer_flame_particles") + && pSettings->line_exist(*cNameSect(), "silencer_light_color") + && pSettings->line_exist(*cNameSect(), "silencer_smoke_particles")) { m_sFlameParticlesCurrent = m_sSilencerFlameParticles; m_sSmokeParticlesCurrent = m_sSilencerSmokeParticles;