From 4c2c511105eda4ec9ccf4bf11841edb20aeffda0 Mon Sep 17 00:00:00 2001 From: aurhat Date: Sun, 15 Oct 2017 13:24:20 +0200 Subject: [PATCH] Fix grenade throwing when switching weapons It fixes the problem that activated grenade disappeared during switching the weapons, when player tried to throw grenade when time for grenade cooking was almost finished. --- source/src/weapon.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 8b9f7dfc..d70a37e9 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -1764,20 +1764,13 @@ void setscope(bool enable) COMMANDF(setscope, "i", (int *on) { setscope(*on != 0); }); - void shoot(playerent *p, vec &targ) { - if(p->state!=CS_ALIVE || p->weaponchanging) return; - weapon *weap = p->weaponsel; - if(weap) - { - weap->attack(targ); - loopi(NUMGUNS) - { - weapon *bweap = p->weapons[i]; - if(bweap != weap && bweap->busy()) bweap->attack(targ); - } - } + if(p->state!=CS_ALIVE) return; + weapon *weap = p->weaponsel, *bweap = p->weapons[GUN_GRENADE]; + if(bweap->busy()) bweap->attack(targ); // continue ongoing nade action + else bweap = NULL; + if(weap && !p->weaponchanging && weap != bweap) weap->attack(targ); } void checkakimbo()