Check finish of team after player joins spectators

Reported by Jupeyy
This commit is contained in:
def 2020-11-20 18:11:06 +01:00
parent b3bbba8f48
commit 9d66c2530b
2 changed files with 7 additions and 1 deletions

View file

@ -631,7 +631,13 @@ void CPlayer::SetTeam(int Team, bool DoChatMsg)
{
CGameControllerDDRace *Controller = (CGameControllerDDRace *)GameServer()->m_pController;
if(g_Config.m_SvTeam != 3)
{
// Joining spectators should not kill a locked team, but should still
// check if the team finished by you leaving it.
int DDRTeam = m_pCharacter->Team();
Controller->m_Teams.SetForceCharacterTeam(m_ClientID, TEAM_FLOCK);
Controller->m_Teams.CheckTeamFinished(DDRTeam);
}
}
KillCharacter();

View file

@ -19,7 +19,6 @@ class CGameTeams
class CGameContext *m_pGameContext;
void CheckTeamFinished(int ClientID);
bool TeamFinished(int Team);
void OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, const char *pTimestamp);
void OnFinish(CPlayer *Player, float Time, const char *pTimestamp);
@ -62,6 +61,7 @@ public:
void OnCharacterDeath(int ClientID, int Weapon);
bool SetCharacterTeam(int ClientID, int Team);
void CheckTeamFinished(int ClientID);
void ChangeTeamState(int Team, int State);
void onChangeTeamState(int Team, int State, int OldState);