Added cvar bot_quota_mode (#103)

This commit is contained in:
Saint146 2017-02-03 14:55:00 +05:00 committed by s1lentq
parent f1f8e2d7b8
commit 507688c745
3 changed files with 10 additions and 3 deletions

View File

@ -39,6 +39,7 @@ cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVAR_SERVER, 0.
#ifdef REGAMEDLL_ADD
cvar_t cv_bot_deathmatch = { "bot_deathmatch", "0", FCVAR_SERVER, 0.0f, NULL };
cvar_t cv_bot_quota_mode = { "bot_quota_mode", "normal", FCVAR_SERVER, 0.0f, NULL };
#endif
void InstallBotControl()
@ -98,6 +99,7 @@ void Bot_RegisterCVars()
#ifdef REGAMEDLL_ADD
CVAR_REGISTER(&cv_bot_deathmatch);
CVAR_REGISTER(&cv_bot_quota_mode);
#endif
}

View File

@ -860,7 +860,11 @@ void CCSBotManager::MaintainBotQuota()
return;
int desiredBotCount = int(cv_bot_quota.value);
int botsInGame = UTIL_BotsInGame();
int occupiedBotSlots = UTIL_BotsInGame();
#ifdef REGAMEDLL_ADD
if (Q_stricmp(cv_bot_quota_mode.string, "fill") == 0)
occupiedBotSlots += humanPlayersInGame;
#endif
if (cv_bot_quota_match.value > 0.0)
{
@ -881,7 +885,7 @@ void CCSBotManager::MaintainBotQuota()
desiredBotCount = Q_min(desiredBotCount, gpGlobals->maxClients - totalHumansInGame);
// add bots if necessary
if (desiredBotCount > botsInGame)
if (desiredBotCount > occupiedBotSlots)
{
// don't try to add a bot if all teams are full
if (!CSGameRules()->TeamFull(TERRORIST) || !CSGameRules()->TeamFull(CT))
@ -894,7 +898,7 @@ void CCSBotManager::MaintainBotQuota()
}
}
}
else if (desiredBotCount < botsInGame)
else if (desiredBotCount < occupiedBotSlots)
{
// kick a bot to maintain quota

View File

@ -210,6 +210,7 @@ extern cvar_t cv_bot_profile_db;
#ifdef REGAMEDLL_ADD
extern cvar_t cv_bot_deathmatch;
extern cvar_t cv_bot_quota_mode;
#endif
#define IS_ALIVE true