From f9ec71cbab638189ea4fa3f664e2584605e2ba0e Mon Sep 17 00:00:00 2001 From: aurhat Date: Tue, 30 Sep 2014 10:33:54 +0200 Subject: [PATCH] Fix switching from spectator to active team in bot modes Before this fix player could switch from spectate to alive mode, but he stayed in SPECTATOR team. Note: 2 mouse clicks are necessary to player's spawn. Second respawnself() is needed, because spawnplayer() is executed before server will switch player1 to active team, so he would always spawn in CLA base (in bot team modes). --- source/src/bot/bot.h | 2 +- source/src/clientgame.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/src/bot/bot.h b/source/src/bot/bot.h index 57d7b162..317d6917 100644 --- a/source/src/bot/bot.h +++ b/source/src/bot/bot.h @@ -355,7 +355,6 @@ class CBotManager void LoadBotNamesFile(void); const char *GetBotName(void); void LoadBotTeamsFile(void); - const char *GetBotTeam(void); void CreateSkillData(void); void InitSkillData(void); void InitBotItems(void); @@ -398,6 +397,7 @@ public: void ViewBot(void); void CalculateMaxAStarCount(void); void PickNextTrigger(void); + const char *GetBotTeam(void); void MakeBotFileName(const char *szFileName, const char *szDir1, const char *szDir2, char *szOutput); diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 6421ca15..b17d94ba 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -726,6 +726,11 @@ void respawnself() if( m_mp(gamemode) ) addmsg(SV_TRYSPAWN, "r"); else { + if(team_isspect(player1->team)) + { + addmsg(SV_SWITCHTEAM, "ri", m_teammode ? teamatoi(BotManager.GetBotTeam()) : rnd(2)); + return; + } showscores(false); setscope(false); setburst(false);