Skip to content

Commit

Permalink
[Bugfix] Fix disappearing grenade
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gunslingermod authored and Xottab-DUTY committed Aug 14, 2017
1 parent e9c867f commit 5e59f8f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/xrGame/WeaponMagazinedWGrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,12 @@ bool CWeaponMagazinedWGrenade::Detach(LPCSTR item_section_name, bool b_spawn_ite
!xr_strcmp(*m_sGrenadeLauncherName, item_section_name))
{
m_flagsAddOnState &= ~CSE_ALifeItemWeapon::eWeaponAddonGrenadeLauncher;
if (m_bGrenadeMode)
{
UnloadMagazine();
PerformSwitchGL();
}

// Now we need to unload GL's magazine
if (!m_bGrenadeMode)
PerformSwitchGL();
UnloadMagazine();
PerformSwitchGL();

UpdateAddonsVisibility();

Expand Down

0 comments on commit 5e59f8f

Please sign in to comment.