summaryrefslogtreecommitdiff
path: root/src/game/g_weapon.c
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2009-10-03 11:50:52 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:24 +0000
commitfce722051b72d556671f62a3668f42dcc2ecb289 (patch)
treeab0738c287bf34cefc20af9786466f1bbe009be2 /src/game/g_weapon.c
parent8ea44e9a37318d6beda7493405825fac974f7a94 (diff)
* Use BG_PrimaryWeapon() in G_ForceWeaponChange() to reduce code duplication
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r--src/game/g_weapon.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 0e8e308a..b68badb9 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -36,7 +36,6 @@ G_ForceWeaponChange
*/
void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon )
{
- int i;
playerState_t *ps = &ent->client->ps;
if( !ent )
@@ -54,21 +53,8 @@ void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon )
!BG_InventoryContainsWeapon( weapon, ps->stats ) )
{
// switch to the first non blaster weapon
- for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
- {
- if( i == WP_BLASTER )
- continue;
-
- if( BG_InventoryContainsWeapon( i, ps->stats ) )
- {
- ps->persistant[ PERS_NEWWEAPON ] = i;
- break;
- }
- }
-
- // only got the blaster to switch to
- if( i == WP_NUM_WEAPONS )
- ps->persistant[ PERS_NEWWEAPON ] = WP_BLASTER;
+ ent->client->ps.persistant[ PERS_NEWWEAPON ] =
+ BG_PrimaryWeapon( ent->client->ps.stats );
}
else
ps->persistant[ PERS_NEWWEAPON ] = weapon;