mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #3341
3341: Check finish of team after player joins spectators r=heinrich5991 a=def- Reported by Jupeyy <!-- What is the motivation for the changes of this pull request --> ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [x] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
6eb56ffb13
|
@ -631,7 +631,13 @@ void CPlayer::SetTeam(int Team, bool DoChatMsg)
|
||||||
{
|
{
|
||||||
CGameControllerDDRace *Controller = (CGameControllerDDRace *)GameServer()->m_pController;
|
CGameControllerDDRace *Controller = (CGameControllerDDRace *)GameServer()->m_pController;
|
||||||
if(g_Config.m_SvTeam != 3)
|
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.SetForceCharacterTeam(m_ClientID, TEAM_FLOCK);
|
||||||
|
Controller->m_Teams.CheckTeamFinished(DDRTeam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KillCharacter();
|
KillCharacter();
|
||||||
|
|
|
@ -19,7 +19,6 @@ class CGameTeams
|
||||||
|
|
||||||
class CGameContext *m_pGameContext;
|
class CGameContext *m_pGameContext;
|
||||||
|
|
||||||
void CheckTeamFinished(int ClientID);
|
|
||||||
bool TeamFinished(int Team);
|
bool TeamFinished(int Team);
|
||||||
void OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, const char *pTimestamp);
|
void OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, const char *pTimestamp);
|
||||||
void OnFinish(CPlayer *Player, 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);
|
void OnCharacterDeath(int ClientID, int Weapon);
|
||||||
|
|
||||||
bool SetCharacterTeam(int ClientID, int Team);
|
bool SetCharacterTeam(int ClientID, int Team);
|
||||||
|
void CheckTeamFinished(int ClientID);
|
||||||
|
|
||||||
void ChangeTeamState(int Team, int State);
|
void ChangeTeamState(int Team, int State);
|
||||||
void onChangeTeamState(int Team, int State, int OldState);
|
void onChangeTeamState(int Team, int State, int OldState);
|
||||||
|
|
Loading…
Reference in a new issue