From 4af2c91fbfd0b9032b89aca17a3553216256dfe1 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 10 Nov 2017 20:28:50 -0600 Subject: [PATCH] Fix -1 (unlimited) ammo decreasing ammo time remaining Gauntlet and Grappling Hook use -1 ammo. Gauntlet is excluded from the check ammo loop but Grappling Hook causes ammo time remaining to decrease 200 milliseconds. The out of ammo check tests time remaining is equal to zero. This means carrying Grappling Hook and out of ammo will have negative time remaining which results in the low ammo message being displayed instead of out of ammo. --- code/cgame/cg_playerstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/cgame/cg_playerstate.c b/code/cgame/cg_playerstate.c index c696a91f..fa79bcb3 100644 --- a/code/cgame/cg_playerstate.c +++ b/code/cgame/cg_playerstate.c @@ -47,6 +47,9 @@ void CG_CheckAmmo( void ) { if ( ! ( weapons & ( 1 << i ) ) ) { continue; } + if ( cg.cur_ps->ammo[i] < 0 ) { + continue; + } switch ( i ) { case WP_ROCKET_LAUNCHER: case WP_GRENADE_LAUNCHER: