Stop caching sv_maxclients in bot code
This commit is contained in:
parent
d1631d6ea3
commit
74aa4268b2
5 changed files with 28 additions and 83 deletions
|
@ -83,13 +83,9 @@ BotNumTeamMates
|
|||
int BotNumTeamMates(bot_state_t *bs) {
|
||||
int i, numplayers;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclients;
|
||||
|
||||
if (!maxclients)
|
||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
|
||||
numplayers = 0;
|
||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||
//if no config string or no name
|
||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||
|
@ -127,7 +123,6 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea
|
|||
|
||||
int i, j, k, numteammates, traveltime;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclients;
|
||||
int traveltimes[MAX_CLIENTS];
|
||||
bot_goal_t *goal = NULL;
|
||||
|
||||
|
@ -150,11 +145,8 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea
|
|||
goal = &blueobelisk;
|
||||
}
|
||||
#endif
|
||||
if (!maxclients)
|
||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
|
||||
numteammates = 0;
|
||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||
//if no config string or no name
|
||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||
|
@ -885,13 +877,9 @@ void BotTeamOrders(bot_state_t *bs) {
|
|||
int teammates[MAX_CLIENTS];
|
||||
int numteammates, i;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclients;
|
||||
|
||||
if (!maxclients)
|
||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
|
||||
numteammates = 0;
|
||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
||||
for (i = 0; i < level.maxclients; i++) {
|
||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||
//if no config string or no name
|
||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue