summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorTony J. White <tjw@tjw.org>2006-11-17 20:15:12 +0000
committerTony J. White <tjw@tjw.org>2006-11-17 20:15:12 +0000
commit6af24abf02f1d0dedc5dbe655a37d5afc9f0646a (patch)
tree53b9dabdf3615a70fbf7a294b68119be6bf0019e /src/game
parent9202903b0f217cb9c5aa10f2aee6d2bc2f8dbab8 (diff)
* (bug 2853) allow energy ammo to be purchased as long as an energy weapon
is in the inventory regardless of what weapon is selected * (bug 2827) allow energy ammo to be purchased at an armoury
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_cmds.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9c1dd05b..e99153d6 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1902,6 +1902,7 @@ void Cmd_Buy_f( gentity_t *ent )
int weapon, upgrade, numItems = 0;
int maxAmmo, maxClips;
qboolean buyingEnergyAmmo = qfalse;
+ qboolean hasEnergyWeapon = qfalse;
for( i = UP_NONE; i < UP_NUM_UPGRADES; i++ )
{
@@ -1912,7 +1913,11 @@ void Cmd_Buy_f( gentity_t *ent )
for( i = WP_NONE; i < WP_NUM_WEAPONS; i++ )
{
if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) )
+ {
+ if( BG_FindUsesEnergyForWeapon( i ) )
+ hasEnergyWeapon = qtrue;
numItems++;
+ }
}
trap_Argv( 1, s, sizeof( s ) );
@@ -1926,15 +1931,19 @@ void Cmd_Buy_f( gentity_t *ent )
//special case to keep norf happy
if( weapon == WP_NONE && upgrade == UP_AMMO )
- buyingEnergyAmmo = BG_FindUsesEnergyForWeapon( ent->client->ps.weapon );
+ {
+ buyingEnergyAmmo = hasEnergyWeapon;
+ }
if( buyingEnergyAmmo )
{
//no armoury nearby
- if( ( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) &&
- !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) )
+ if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) &&
+ !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) &&
+ !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) )
{
- trap_SendServerCommand( ent-g_entities, va( "print \"You must be near a reactor or repeater\n\"" ) );
+ trap_SendServerCommand( ent-g_entities, va(
+ "print \"You must be near a reactor, repeater or armoury\n\"" ) );
return;
}
}