Skip to content

Commit

Permalink
Simplified Bots column in server browser UI, automatically set if bot…
Browse files Browse the repository at this point in the history
…s are in
  • Loading branch information
darkshade9 committed Sep 14, 2024
1 parent e5d1b73 commit f9f1679
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
12 changes: 6 additions & 6 deletions src/action/botlib/botlib_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,18 +2184,18 @@ void BOTLIB_CheckBotRules(void)
}

// Remove ALL bots
if (bot_connections.total_bots > 0 && bot_connections.desire_bots == 0)
{
if (bot_connections.total_bots > 0 && bot_connections.desire_bots == 0) {
BOTLIB_RemoveBot("ALL");
bot_connections.total_team1 = 0;
bot_connections.total_team2 = 0;
bot_connections.total_team3 = 0;
}

// Update 'am' cvar to reflect in Server UI list if server has bots or not
if (bot_connections.total_bots > 0)
gi.cvar_forceset(am->string, "1");
else
gi.cvar_forceset(am->string, "0");
if (bot_connections.total_bots > 0) {
gi.cvar_forceset(am->name, "1");
} else {
gi.cvar_forceset(am->name, "0");
}
}
//rekkie -- DEV_1 -- e
21 changes: 1 addition & 20 deletions src/client/ui/servers.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,31 +262,12 @@ void UI_StatusEvent(const serverStatus_t *status)

const char *am = "No";
#if USE_AQTION
size_t ambci;

const char *hasBotsCheck = Info_ValueForKey(status->infostring, "am");
const char *botsCountCheck = Info_ValueForKey(status->infostring, "am_botcount");

if (hasBotsCheck == NULL || COM_IsWhite(hasBotsCheck) || *hasBotsCheck == '0') {
am = "No";
if (slot) {
slot->hasBots = false;
}
} else {
if (slot) {
ambci = atoi(botsCountCheck);
if (ambci < 0) {
ambci = 0;
}
slot->numBots = ambci;

// Don't count bots if humans equal or outnumber ambci
if (playerCount >= slot->numBots) {
playerCount = status->numPlayers;
} else {
playerCount = status->numPlayers + slot->numBots;
}
}
am = "Yes";
}
#endif

Expand Down

0 comments on commit f9f1679

Please sign in to comment.