Skip to content

Commit

Permalink
Fix team orders menu not listing clients with lower clientnums
Browse files Browse the repository at this point in the history
If bots join before the local client (dedicated server) the bots would
not be listed in the Q3A team orders menu and so they could not be given
orders using the menu.

The Q3A team orders menu got local client's team while looping through
all clients. Ignoring any bots with clientnum lower than the local
client. Get local client's team before the loop so all bots are
listed.
  • Loading branch information
zturtleman committed Oct 29, 2019
1 parent 34c0722 commit dc0c3e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/q3_ui/ui_teamorders.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static void UI_TeamOrdersMenu_BuildBotList( void ) {
int numPlayers;
int isBot;
int n;
char playerTeam = '3';
char playerTeam;
char botTeam;
char info[MAX_INFO_STRING];

Expand All @@ -312,14 +312,16 @@ static void UI_TeamOrdersMenu_BuildBotList( void ) {
numPlayers = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );

for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) {
trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING );
playerTeam = *Info_ValueForKey( info, "t" );

for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) {
if( n == cs.clientNum ) {
playerTeam = *Info_ValueForKey( info, "t" );
continue;
}

trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );

isBot = atoi( Info_ValueForKey( info, "skill" ) );
if( !isBot ) {
continue;
Expand Down

0 comments on commit dc0c3e7

Please sign in to comment.