summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Ellis <johne@verizon.net>2010-11-14 15:41:17 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:43 +0000
commit9e56da44d1dfa0e61b19c2fad0db8a40f658e9ef (patch)
tree2b250626ef3149119de2c9ee9dda39306d6f6efc /src
parent344bde640278d92c1cae2802e72ba6d866d25006 (diff)
* (bug 4759) Make trigger_ammo use the primary weapon so that
holding a blaster does not subtract ammo. ( thanks Teapot )
Diffstat (limited to 'src')
-rw-r--r--src/game/g_trigger.c10
1 files changed, 6 insertions, 4 deletions
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 )
{