fix: adding/removing bots during round restart causes "SZ_GetSpace: tried to write to an uninitialized sizebuf_t: ???"

This commit is contained in:
ds 2020-10-13 12:38:24 +03:00
commit 1cad8919b4
3 changed files with 23 additions and 7 deletions

View file

@ -1112,6 +1112,11 @@ bool BotManager::isTeamStacked (int team) {
void BotManager::erase (Bot *bot) {
for (auto &e : m_bots) {
if (e.get () == bot) {
bot->showChaterIcon (false);
bot->markStale ();
conf.clearUsedName (bot); // clear the bot name
e.reset ();
m_bots.remove (e); // remove from bots array
@ -1418,14 +1423,20 @@ void Bot::kick () {
if (!(pev->flags & FL_CLIENT) || strings.isEmpty (username)) {
return;
}
// clear fakeclient bit
pev->flags &= ~FL_FAKECLIENT;
markStale ();
game.serverCommand ("kick \"%s\"", username);
ctrl.msg ("Bot '%s' kicked.", username);
}
void Bot::markStale () {
// clear fakeclient bit
pev->flags &= ~FL_FAKECLIENT;
// make as not receiveing any messages
pev->flags |= FL_DORMANT;
}
void Bot::updateTeamJoin () {
// this function handles the selection of teams & class