From 9e56da44d1dfa0e61b19c2fad0db8a40f658e9ef Mon Sep 17 00:00:00 2001 From: John Ellis Date: Sun, 14 Nov 2010 15:41:17 +0000 Subject: * (bug 4759) Make trigger_ammo use the primary weapon so that holding a blaster does not subtract ammo. ( thanks Teapot ) --- src/game/g_trigger.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/game') diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index df17ff18..65bf1bd1 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -1083,6 +1083,7 @@ trigger_ammo_touch void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int maxClips, maxAmmo; + weapon_t weapon; if( !other->client ) return; @@ -1096,10 +1097,11 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) if( other->client->ps.weaponstate != WEAPON_READY ) return; - if( BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 2 ) + weapon = BG_PrimaryWeapon( other->client->ps.stats ); + if( BG_Weapon( weapon )->usesEnergy && self->spawnflags & 2 ) return; - if( !BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 4 ) + if( !BG_Weapon( weapon )->usesEnergy && self->spawnflags & 4 ) return; if( self->spawnflags & 1 ) @@ -1107,8 +1109,8 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) else self->timestamp = level.time + FRAMETIME; - maxAmmo = BG_Weapon( other->client->ps.weapon )->maxAmmo; - maxClips = BG_Weapon( other->client->ps.weapon )->maxClips; + maxAmmo = BG_Weapon( weapon )->maxAmmo; + maxClips = BG_Weapon( weapon )->maxClips; if( ( other->client->ps.ammo + self->damage ) > maxAmmo ) { -- cgit