Stop caching sv_maxclients in bot code

This commit is contained in:
Zack Middleton 2017-06-07 19:00:28 -05:00
parent d1631d6ea3
commit 74aa4268b2
5 changed files with 28 additions and 83 deletions

View file

@ -392,7 +392,7 @@ void BotTeamplayReport(void) {
char buf[MAX_INFO_STRING];
BotAI_Print(PRT_MESSAGE, S_COLOR_RED"RED\n");
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
for (i = 0; i < level.maxclients; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse ) continue;
//
@ -405,7 +405,7 @@ void BotTeamplayReport(void) {
}
}
BotAI_Print(PRT_MESSAGE, S_COLOR_BLUE"BLUE\n");
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
for (i = 0; i < level.maxclients; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse ) continue;
//
@ -546,7 +546,7 @@ void BotUpdateInfoConfigStrings(void) {
int i;
char buf[MAX_INFO_STRING];
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
for (i = 0; i < level.maxclients; i++) {
//
if ( !botstates[i] || !botstates[i]->inuse )
continue;
@ -1597,8 +1597,7 @@ int BotInitLibrary(void) {
char buf[144];
//set the maxclients and maxentities library variables before calling BotSetupLibrary
trap_Cvar_VariableStringBuffer("sv_maxclients", buf, sizeof(buf));
if (!strlen(buf)) strcpy(buf, "8");
Com_sprintf(buf, sizeof(buf), "%d", level.maxclients);
trap_BotLibVarSet("maxclients", buf);
Com_sprintf(buf, sizeof(buf), "%d", MAX_GENTITIES);
trap_BotLibVarSet("maxentities", buf);