Skip to content

Commit 5e59f8f

Browse files
gunslingermodXottab-DUTY
authored andcommitted
[Bugfix] Fix disappearing grenade
The way to reproduce: 1) Attach grenade launcher to the weapon 2) Switch to GL mode and reload GL 3) Switch back to bullets 4) Detach GL. GL would be spawned to the inventory, but loaded grenade would stay in the weapon. It happens because weapon has 2 magazines: for current active ammo and for secondary (inactive) ammo. So, you should force game to unload ammos from "GL's" mag.
1 parent e9c867f commit 5e59f8f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/xrGame/WeaponMagazinedWGrenade.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,12 @@ bool CWeaponMagazinedWGrenade::Detach(LPCSTR item_section_name, bool b_spawn_ite
512512
!xr_strcmp(*m_sGrenadeLauncherName, item_section_name))
513513
{
514514
m_flagsAddOnState &= ~CSE_ALifeItemWeapon::eWeaponAddonGrenadeLauncher;
515-
if (m_bGrenadeMode)
516-
{
517-
UnloadMagazine();
518-
PerformSwitchGL();
519-
}
515+
516+
// Now we need to unload GL's magazine
517+
if (!m_bGrenadeMode)
518+
PerformSwitchGL();
519+
UnloadMagazine();
520+
PerformSwitchGL();
520521

521522
UpdateAddonsVisibility();
522523

0 commit comments

Comments
 (0)