diff options
-rw-r--r-- | src/game/bg_misc.c | 21 | ||||
-rw-r--r-- | src/game/g_cmds.c | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 5177957c..06b85773 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3864,3 +3864,24 @@ void BG_ClientListParse( clientList_t *list, const char *s ) sscanf( s, "%x%x", &list->hi, &list->lo ); } +/* +============ +BG_PrimaryWeapon +============ +*/ +weapon_t BG_PrimaryWeapon( int stats[ ] ) +{ + int i; + + for( i = WP_NONE; i < WP_NUM_WEAPONS; i++ ) + { + if( BG_Weapon( i )->slots != SLOT_WEAPON ) + continue; + if( BG_InventoryContainsWeapon( i, stats ) ) + return i; + } + if( BG_InventoryContainsWeapon( WP_BLASTER, stats ) ) + return WP_BLASTER; + return WP_NONE; +} + diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 755356b1..88baf39c 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2088,6 +2088,7 @@ void Cmd_Buy_f( gentity_t *ent ) } VectorCopy( newOrigin, ent->s.pos.trBase ); ent->client->ps.stats[ STAT_CLASS ] = PCL_HUMAN_BSUIT; + ent->client->pers.classSelection = PCL_HUMAN_BSUIT; ent->client->ps.eFlags ^= EF_TELEPORT_BIT; } @@ -2190,6 +2191,7 @@ void Cmd_Sell_f( gentity_t *ent ) } VectorCopy( newOrigin, ent->s.pos.trBase ); ent->client->ps.stats[ STAT_CLASS ] = PCL_HUMAN; + ent->client->pers.classSelection = PCL_HUMAN; ent->client->ps.eFlags ^= EF_TELEPORT_BIT; } |