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.
This commit is contained in:
aurhat
2017-10-15 13:25:42 +02:00
parent 1d7dd9df84
commit 4c2c511105
+5 -12
View File
@@ -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()