mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Check whether team has finished once a player in the team kills
This commit is contained in:
parent
3804c16f02
commit
2c2b77ac3b
|
@ -110,32 +110,37 @@ void CGameTeams::OnCharacterFinish(int ClientID)
|
|||
else
|
||||
{
|
||||
m_TeeFinished[ClientID] = true;
|
||||
if (TeamFinished(m_Core.Team(ClientID)))
|
||||
|
||||
CheckTeamFinished(m_Core.Team(ClientID));
|
||||
}
|
||||
}
|
||||
|
||||
void CGameTeams::CheckTeamFinished(int Team)
|
||||
{
|
||||
if (TeamFinished(Team))
|
||||
{
|
||||
ChangeTeamState(Team, TEAMSTATE_FINISHED); //TODO: Make it better
|
||||
//ChangeTeamState(Team, TEAMSTATE_OPEN);
|
||||
|
||||
CPlayer *TeamPlayers[MAX_CLIENTS];
|
||||
unsigned int PlayersCount = 0;
|
||||
|
||||
for (int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
ChangeTeamState(m_Core.Team(ClientID), TEAMSTATE_FINISHED); //TODO: Make it better
|
||||
//ChangeTeamState(m_Core.Team(ClientID), TEAMSTATE_OPEN);
|
||||
|
||||
CPlayer *TeamPlayers[MAX_CLIENTS];
|
||||
unsigned int PlayersCount = 0;
|
||||
|
||||
for (int i = 0; i < MAX_CLIENTS; ++i)
|
||||
if (Team == m_Core.Team(i))
|
||||
{
|
||||
if (m_Core.Team(ClientID) == m_Core.Team(i))
|
||||
CPlayer* pPlayer = GetPlayer(i);
|
||||
if (pPlayer && pPlayer->IsPlaying())
|
||||
{
|
||||
CPlayer* pPlayer = GetPlayer(i);
|
||||
if (pPlayer && pPlayer->IsPlaying())
|
||||
{
|
||||
OnFinish(pPlayer);
|
||||
m_TeeFinished[i] = false;
|
||||
OnFinish(pPlayer);
|
||||
m_TeeFinished[i] = false;
|
||||
|
||||
TeamPlayers[PlayersCount++] = pPlayer;
|
||||
}
|
||||
TeamPlayers[PlayersCount++] = pPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
OnTeamFinish(TeamPlayers, PlayersCount);
|
||||
|
||||
}
|
||||
|
||||
OnTeamFinish(TeamPlayers, PlayersCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -599,7 +604,10 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon)
|
|||
bool Locked = TeamLocked(Team) && Weapon != WEAPON_GAME;
|
||||
|
||||
if (!Locked)
|
||||
{
|
||||
SetForceCharacterTeam(ClientID, 0);
|
||||
CheckTeamFinished(Team);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetForceCharacterTeam(ClientID, Team);
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
void OnCharacterSpawn(int ClientID);
|
||||
void OnCharacterDeath(int ClientID, int Weapon);
|
||||
|
||||
void CheckTeamFinished(int ClientID);
|
||||
bool SetCharacterTeam(int ClientID, int Team);
|
||||
|
||||
void ChangeTeamState(int Team, int State);
|
||||
|
|
Loading…
Reference in a new issue