From 9e521dfd4a0c4d5e03a7529e333f1f6c93c7b8fa Mon Sep 17 00:00:00 2001 From: aurhat Date: Sat, 17 Sep 2016 18:25:33 +0200 Subject: [PATCH] Fix setting random skin of RVSF bots Also improve assignment bots to teams. --- source/src/bot/botmanager.cpp | 4 ++-- source/src/protos.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/src/bot/botmanager.cpp b/source/src/bot/botmanager.cpp index 173e95f2..1a360c70 100644 --- a/source/src/bot/botmanager.cpp +++ b/source/src/bot/botmanager.cpp @@ -881,7 +881,6 @@ botent *CBotManager::CreateBot(const char *team, const char *skill, const char * if (!m) return NULL; loopi(NUMGUNS) m->ammo[i] = m->mag[i] = 0; m->lifesequence = 0; - setskin(m, rnd(6)); m->pBot = new CACBot; m->type = ENT_BOT; m->pBot->m_pMyEnt = m; @@ -894,7 +893,8 @@ botent *CBotManager::CreateBot(const char *team, const char *skill, const char * updateclientname((playerent *)m); const char *tempteam = team && *team && strcmp(team, "random") ? team : BotManager.GetBotTeam(); - loopi(TEAM_NUM) if(!strcmp(teamnames[i], tempteam)) { m->team = i; break; } + m->team = team_base(teamatoi(tempteam)); + setskin(m, m->team == TEAM_CLA ? rnd(4) : rnd(6), m->team); if (skill && *skill && strcmp(skill, "random")) { diff --git a/source/src/protos.h b/source/src/protos.h index 81598640..1b73e402 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -547,6 +547,7 @@ extern botent *newbotent(); extern void freebotent(botent *d); extern char *getclientmap(); extern int getclientmode(); +extern int teamatoi(const char *name); extern void zapplayer(playerent *&d); extern playerent *getclient(int cn); extern playerent *newclient(int cn);