mirror of https://github.com/ioquake/ioq3.git
Stop caching sv_maxclients in bot code
This commit is contained in:
parent
d1631d6ea3
commit
74aa4268b2
|
@ -68,13 +68,9 @@ BotNumActivePlayers
|
||||||
int BotNumActivePlayers(void) {
|
int BotNumActivePlayers(void) {
|
||||||
int i, num;
|
int i, num;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
num = 0;
|
num = 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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -94,14 +90,10 @@ BotIsFirstInRankings
|
||||||
int BotIsFirstInRankings(bot_state_t *bs) {
|
int BotIsFirstInRankings(bot_state_t *bs) {
|
||||||
int i, score;
|
int i, score;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
playerState_t ps;
|
playerState_t ps;
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
score = bs->cur_ps.persistant[PERS_SCORE];
|
score = bs->cur_ps.persistant[PERS_SCORE];
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -122,14 +114,10 @@ BotIsLastInRankings
|
||||||
int BotIsLastInRankings(bot_state_t *bs) {
|
int BotIsLastInRankings(bot_state_t *bs) {
|
||||||
int i, score;
|
int i, score;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
playerState_t ps;
|
playerState_t ps;
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
score = bs->cur_ps.persistant[PERS_SCORE];
|
score = bs->cur_ps.persistant[PERS_SCORE];
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -151,15 +139,11 @@ char *BotFirstClientInRankings(void) {
|
||||||
int i, bestscore, bestclient;
|
int i, bestscore, bestclient;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static char name[32];
|
static char name[32];
|
||||||
static int maxclients;
|
|
||||||
playerState_t ps;
|
playerState_t ps;
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
bestscore = -999999;
|
bestscore = -999999;
|
||||||
bestclient = 0;
|
bestclient = 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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -185,15 +169,11 @@ char *BotLastClientInRankings(void) {
|
||||||
int i, worstscore, bestclient;
|
int i, worstscore, bestclient;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static char name[32];
|
static char name[32];
|
||||||
static int maxclients;
|
|
||||||
playerState_t ps;
|
playerState_t ps;
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
worstscore = 999999;
|
worstscore = 999999;
|
||||||
bestclient = 0;
|
bestclient = 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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -219,15 +199,11 @@ char *BotRandomOpponentName(bot_state_t *bs) {
|
||||||
int i, count;
|
int i, count;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
int opponents[MAX_CLIENTS], numopponents;
|
int opponents[MAX_CLIENTS], numopponents;
|
||||||
static int maxclients;
|
|
||||||
static char name[32];
|
static char name[32];
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
numopponents = 0;
|
numopponents = 0;
|
||||||
opponents[0] = 0;
|
opponents[0] = 0;
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//
|
//
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
|
|
|
@ -237,15 +237,12 @@ FindClientByName
|
||||||
int FindClientByName(char *name) {
|
int FindClientByName(char *name) {
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
||||||
ClientName(i, buf, sizeof(buf));
|
ClientName(i, buf, sizeof(buf));
|
||||||
if (!Q_stricmp(buf, name)) return i;
|
if (!Q_stricmp(buf, name)) return i;
|
||||||
}
|
}
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
ClientName(i, buf, sizeof(buf));
|
ClientName(i, buf, sizeof(buf));
|
||||||
if (stristr(buf, name)) return i;
|
if (stristr(buf, name)) return i;
|
||||||
}
|
}
|
||||||
|
@ -260,16 +257,13 @@ FindEnemyByName
|
||||||
int FindEnemyByName(bot_state_t *bs, char *name) {
|
int FindEnemyByName(bot_state_t *bs, char *name) {
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
||||||
if (BotSameTeam(bs, i)) continue;
|
if (BotSameTeam(bs, i)) continue;
|
||||||
ClientName(i, buf, sizeof(buf));
|
ClientName(i, buf, sizeof(buf));
|
||||||
if (!Q_stricmp(buf, name)) return i;
|
if (!Q_stricmp(buf, name)) return i;
|
||||||
}
|
}
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (BotSameTeam(bs, i)) continue;
|
if (BotSameTeam(bs, i)) continue;
|
||||||
ClientName(i, buf, sizeof(buf));
|
ClientName(i, buf, sizeof(buf));
|
||||||
if (stristr(buf, name)) return i;
|
if (stristr(buf, name)) return i;
|
||||||
|
@ -285,13 +279,9 @@ NumPlayersOnSameTeam
|
||||||
int NumPlayersOnSameTeam(bot_state_t *bs) {
|
int NumPlayersOnSameTeam(bot_state_t *bs) {
|
||||||
int i, num;
|
int i, num;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, MAX_INFO_STRING);
|
trap_GetConfigstring(CS_PLAYERS+i, buf, MAX_INFO_STRING);
|
||||||
if (strlen(buf)) {
|
if (strlen(buf)) {
|
||||||
if (BotSameTeam(bs, i+1)) num++;
|
if (BotSameTeam(bs, i+1)) num++;
|
||||||
|
|
|
@ -72,7 +72,6 @@ bot_waypoint_t *botai_freewaypoints;
|
||||||
|
|
||||||
//NOTE: not using a cvars which can be updated because the game should be reloaded anyway
|
//NOTE: not using a cvars which can be updated because the game should be reloaded anyway
|
||||||
int gametype; //game type
|
int gametype; //game type
|
||||||
int maxclients; //maximum number of clients
|
|
||||||
|
|
||||||
vmCvar_t bot_grapple;
|
vmCvar_t bot_grapple;
|
||||||
vmCvar_t bot_rocketjump;
|
vmCvar_t bot_rocketjump;
|
||||||
|
@ -1427,11 +1426,8 @@ ClientFromName
|
||||||
int ClientFromName(char *name) {
|
int ClientFromName(char *name) {
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
Q_CleanStr( buf );
|
Q_CleanStr( buf );
|
||||||
if (!Q_stricmp(Info_ValueForKey(buf, "n"), name)) return i;
|
if (!Q_stricmp(Info_ValueForKey(buf, "n"), name)) return i;
|
||||||
|
@ -1447,11 +1443,8 @@ ClientOnSameTeamFromName
|
||||||
int ClientOnSameTeamFromName(bot_state_t *bs, char *name) {
|
int ClientOnSameTeamFromName(bot_state_t *bs, char *name) {
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
|
||||||
if (!BotSameTeam(bs, i))
|
if (!BotSameTeam(bs, i))
|
||||||
continue;
|
continue;
|
||||||
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
|
@ -2983,7 +2976,7 @@ int BotFindEnemy(bot_state_t *bs, int curenemy) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
|
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//if it's the current enemy
|
//if it's the current enemy
|
||||||
|
@ -3062,7 +3055,7 @@ int BotTeamFlagCarrierVisible(bot_state_t *bs) {
|
||||||
float vis;
|
float vis;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client)
|
if (i == bs->client)
|
||||||
continue;
|
continue;
|
||||||
//
|
//
|
||||||
|
@ -3095,7 +3088,7 @@ int BotTeamFlagCarrier(bot_state_t *bs) {
|
||||||
int i;
|
int i;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client)
|
if (i == bs->client)
|
||||||
continue;
|
continue;
|
||||||
//
|
//
|
||||||
|
@ -3125,7 +3118,7 @@ int BotEnemyFlagCarrierVisible(bot_state_t *bs) {
|
||||||
float vis;
|
float vis;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client)
|
if (i == bs->client)
|
||||||
continue;
|
continue;
|
||||||
//
|
//
|
||||||
|
@ -3164,7 +3157,7 @@ void BotVisibleTeamMatesAndEnemies(bot_state_t *bs, int *teammates, int *enemies
|
||||||
*teammates = 0;
|
*teammates = 0;
|
||||||
if (enemies)
|
if (enemies)
|
||||||
*enemies = 0;
|
*enemies = 0;
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client)
|
if (i == bs->client)
|
||||||
continue;
|
continue;
|
||||||
//
|
//
|
||||||
|
@ -3206,7 +3199,7 @@ int BotTeamCubeCarrierVisible(bot_state_t *bs) {
|
||||||
float vis;
|
float vis;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//
|
//
|
||||||
BotEntityInfo(i, &entinfo);
|
BotEntityInfo(i, &entinfo);
|
||||||
|
@ -3235,7 +3228,7 @@ int BotEnemyCubeCarrierVisible(bot_state_t *bs) {
|
||||||
float vis;
|
float vis;
|
||||||
aas_entityinfo_t entinfo;
|
aas_entityinfo_t entinfo;
|
||||||
|
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
if (i == bs->client)
|
if (i == bs->client)
|
||||||
continue;
|
continue;
|
||||||
//
|
//
|
||||||
|
@ -3706,7 +3699,7 @@ void BotMapScripts(bot_state_t *bs) {
|
||||||
}
|
}
|
||||||
shootbutton = qfalse;
|
shootbutton = qfalse;
|
||||||
//if an enemy is below this bounding box then shoot the button
|
//if an enemy is below this bounding box then shoot the button
|
||||||
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
|
for (i = 0; i < level.maxclients; i++) {
|
||||||
|
|
||||||
if (i == bs->client) continue;
|
if (i == bs->client) continue;
|
||||||
//
|
//
|
||||||
|
@ -5403,7 +5396,6 @@ void BotSetupDeathmatchAI(void) {
|
||||||
char model[128];
|
char model[128];
|
||||||
|
|
||||||
gametype = trap_Cvar_VariableIntegerValue("g_gametype");
|
gametype = trap_Cvar_VariableIntegerValue("g_gametype");
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
trap_Cvar_Register(&bot_rocketjump, "bot_rocketjump", "1", 0);
|
trap_Cvar_Register(&bot_rocketjump, "bot_rocketjump", "1", 0);
|
||||||
trap_Cvar_Register(&bot_grapple, "bot_grapple", "0", 0);
|
trap_Cvar_Register(&bot_grapple, "bot_grapple", "0", 0);
|
||||||
|
|
|
@ -392,7 +392,7 @@ void BotTeamplayReport(void) {
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
|
|
||||||
BotAI_Print(PRT_MESSAGE, S_COLOR_RED"RED\n");
|
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;
|
if ( !botstates[i] || !botstates[i]->inuse ) continue;
|
||||||
//
|
//
|
||||||
|
@ -405,7 +405,7 @@ void BotTeamplayReport(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BotAI_Print(PRT_MESSAGE, S_COLOR_BLUE"BLUE\n");
|
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;
|
if ( !botstates[i] || !botstates[i]->inuse ) continue;
|
||||||
//
|
//
|
||||||
|
@ -546,7 +546,7 @@ void BotUpdateInfoConfigStrings(void) {
|
||||||
int i;
|
int i;
|
||||||
char buf[MAX_INFO_STRING];
|
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 )
|
if ( !botstates[i] || !botstates[i]->inuse )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1597,8 +1597,7 @@ int BotInitLibrary(void) {
|
||||||
char buf[144];
|
char buf[144];
|
||||||
|
|
||||||
//set the maxclients and maxentities library variables before calling BotSetupLibrary
|
//set the maxclients and maxentities library variables before calling BotSetupLibrary
|
||||||
trap_Cvar_VariableStringBuffer("sv_maxclients", buf, sizeof(buf));
|
Com_sprintf(buf, sizeof(buf), "%d", level.maxclients);
|
||||||
if (!strlen(buf)) strcpy(buf, "8");
|
|
||||||
trap_BotLibVarSet("maxclients", buf);
|
trap_BotLibVarSet("maxclients", buf);
|
||||||
Com_sprintf(buf, sizeof(buf), "%d", MAX_GENTITIES);
|
Com_sprintf(buf, sizeof(buf), "%d", MAX_GENTITIES);
|
||||||
trap_BotLibVarSet("maxentities", buf);
|
trap_BotLibVarSet("maxentities", buf);
|
||||||
|
|
|
@ -83,13 +83,9 @@ BotNumTeamMates
|
||||||
int BotNumTeamMates(bot_state_t *bs) {
|
int BotNumTeamMates(bot_state_t *bs) {
|
||||||
int i, numplayers;
|
int i, numplayers;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
numplayers = 0;
|
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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
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;
|
int i, j, k, numteammates, traveltime;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
int traveltimes[MAX_CLIENTS];
|
int traveltimes[MAX_CLIENTS];
|
||||||
bot_goal_t *goal = NULL;
|
bot_goal_t *goal = NULL;
|
||||||
|
|
||||||
|
@ -150,11 +145,8 @@ int BotSortTeamMatesByBaseTravelTime(bot_state_t *bs, int *teammates, int maxtea
|
||||||
goal = &blueobelisk;
|
goal = &blueobelisk;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
numteammates = 0;
|
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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
@ -885,13 +877,9 @@ void BotTeamOrders(bot_state_t *bs) {
|
||||||
int teammates[MAX_CLIENTS];
|
int teammates[MAX_CLIENTS];
|
||||||
int numteammates, i;
|
int numteammates, i;
|
||||||
char buf[MAX_INFO_STRING];
|
char buf[MAX_INFO_STRING];
|
||||||
static int maxclients;
|
|
||||||
|
|
||||||
if (!maxclients)
|
|
||||||
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
|
||||||
|
|
||||||
numteammates = 0;
|
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));
|
trap_GetConfigstring(CS_PLAYERS+i, buf, sizeof(buf));
|
||||||
//if no config string or no name
|
//if no config string or no name
|
||||||
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
|
||||||
|
|
Loading…
Reference in New Issue