Reworked bot_quota_mode and removed bot_quota_match cvar's (Migrated to bot_quota_mode)

This commit is contained in:
s1lent 2019-06-22 02:54:01 +07:00
parent 9ed19456f0
commit 0aa974cd63
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
4 changed files with 21 additions and 7 deletions

View File

@ -39,7 +39,6 @@ cvar_t cv_bot_difficulty = { "bot_difficulty", "0", FCVAR_SERVER, 0.
cvar_t cv_bot_debug = { "bot_debug", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_quicksave = { "bot_quicksave", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_quota = { "bot_quota", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_quota_match = { "bot_quota_match", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_prefix = { "bot_prefix", "", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_allow_rogues = { "bot_allow_rogues", "1", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_allow_pistols = { "bot_allow_pistols", "1", FCVAR_SERVER, 0.0f, nullptr };
@ -61,6 +60,9 @@ cvar_t cv_bot_profile_db = { "bot_profile_db", "BotProfile.db", FCVA
#ifdef REGAMEDLL_ADD
cvar_t cv_bot_deathmatch = { "bot_deathmatch", "0", FCVAR_SERVER, 0.0f, nullptr };
cvar_t cv_bot_quota_mode = { "bot_quota_mode", "normal", FCVAR_SERVER, 0.0f, nullptr };
#else
// Migrated to bot_quota_mode, use "match"
cvar_t cv_bot_quota_match = { "bot_quota_match", "0", FCVAR_SERVER, 0.0f, nullptr };
#endif
void InstallBotControl()
@ -99,7 +101,11 @@ void Bot_RegisterCVars()
CVAR_REGISTER(&cv_bot_debug);
CVAR_REGISTER(&cv_bot_quicksave);
CVAR_REGISTER(&cv_bot_quota);
#ifndef REGAMEDLL_ADD
CVAR_REGISTER(&cv_bot_quota_match);
#endif
CVAR_REGISTER(&cv_bot_prefix);
CVAR_REGISTER(&cv_bot_allow_rogues);
CVAR_REGISTER(&cv_bot_allow_pistols);

View File

@ -39,7 +39,6 @@ extern cvar_t cv_bot_difficulty;
extern cvar_t cv_bot_debug;
extern cvar_t cv_bot_quicksave;
extern cvar_t cv_bot_quota;
extern cvar_t cv_bot_quota_match;
extern cvar_t cv_bot_prefix;
extern cvar_t cv_bot_allow_rogues;
extern cvar_t cv_bot_allow_pistols;
@ -61,4 +60,6 @@ extern cvar_t cv_bot_profile_db;
#ifdef REGAMEDLL_ADD
extern cvar_t cv_bot_deathmatch;
extern cvar_t cv_bot_quota_mode;
#else
extern cvar_t cv_bot_quota_match;
#endif

View File

@ -828,15 +828,22 @@ void CCSBotManager::MaintainBotQuota()
int desiredBotCount = int(cv_bot_quota.value);
int occupiedBotSlots = UTIL_BotsInGame();
#ifdef REGAMEDLL_ADD
if (Q_stricmp(cv_bot_quota_mode.string, "fill") == 0)
occupiedBotSlots += humanPlayersInGame;
#endif
#ifdef REGAMEDLL_ADD
if (FStrEq(cv_bot_quota_mode.string, "fill"))
{
desiredBotCount = Q_max(0, desiredBotCount - humanPlayersInGame);
}
else if (FStrEq(cv_bot_quota_mode.string, "match"))
{
desiredBotCount = Q_max<int>(0, cv_bot_quota.value * humanPlayersInGame);
}
#else // #ifdef REGAMEDLL_ADD
if (cv_bot_quota_match.value > 0.0)
{
desiredBotCount = int(humanPlayersInGame * cv_bot_quota_match.value);
}
#endif // #ifdef REGAMEDLL_ADD
// wait for a player to join, if necessary
if (cv_bot_join_after_player.value > 0.0)

View File

@ -112,7 +112,7 @@ int UTIL_HumansInGame(bool ignoreSpectators)
continue;
#ifdef REGAMEDLL_FIXES
if (pPlayer->IsProxy())
if (ignoreSpectators && pPlayer->IsProxy())
continue;
#endif