Prevent bot auto-creation when removing bot, by delaying quota maintaining time.

This commit is contained in:
jeefo 2016-11-02 18:36:05 +03:00
commit 6769ddca39
2 changed files with 14 additions and 10 deletions

View file

@ -368,11 +368,13 @@ void BotManager::AdjustQuota (bool isPlayerConnecting, edict_t *ent)
{
RemoveRandom ();
m_balanceCount--;
m_quotaMaintainTime = engine.Time () + 2.0f;
}
}
else if (m_balanceCount < 0)
{
AddRandom (false);
AddRandom ();
m_balanceCount++;
}
}
@ -475,21 +477,23 @@ void BotManager::MaintainBotQuota (void)
}
int numBots = GetBotsNum ();
int numHumans = yb_autovacate_smart_kick.GetBool () ? GetHumansJoinedTeam () : GetHumansNum ();
int numHumans = GetHumansNum ();
int desiredCount = yb_quota.GetInt ();
if (yb_join_after_player.GetBool () && !numHumans)
desiredCount = 0;
int numHumansOnTeam = yb_autovacate_smart_kick.GetBool () ? GetHumansJoinedTeam () : numHumans;
// quota mode
char mode = yb_quota_mode.GetString ()[0];
if (mode == 'f' || mode == 'F') // fill
desiredCount = A_max (0, desiredCount - numHumans);
desiredCount = A_max (0, desiredCount - numHumansOnTeam);
else if (mode == 'm' || mode == 'M') // match
desiredCount = A_max (0, yb_quota.GetInt () * numHumans);
desiredCount = A_max (0, yb_quota.GetInt () * numHumansOnTeam);
desiredCount = A_min (desiredCount, engine.MaxClients () - (numHumans + (yb_autovacate.GetBool () ? 1 : 0)));
desiredCount = A_min (desiredCount, engine.MaxClients () - (numHumansOnTeam + (yb_autovacate.GetBool () ? 1 : 0)));
if (yb_autovacate_smart_kick.GetBool () && numBots > 1 && desiredCount > 1)
VerifyPlayersHasJoinedTeam (desiredCount);