mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Newly joined player should not immediately be subtracted from team 0
This commit is contained in:
parent
d3b6df97f8
commit
88b65b6def
|
@ -269,6 +269,21 @@ void CGameTeams::SetForceCharacterTeam(int ClientID, int Team)
|
|||
m_MembersCount[m_Core.Team(ClientID)]--;
|
||||
}
|
||||
|
||||
SetForceCharacterNewTeam(ClientID, Team);
|
||||
|
||||
if (OldTeam != Team)
|
||||
{
|
||||
for(int LoopClientID = 0; LoopClientID < MAX_CLIENTS; ++LoopClientID)
|
||||
if(GetPlayer(LoopClientID))
|
||||
SendTeamsState(LoopClientID);
|
||||
|
||||
if(GetPlayer(ClientID))
|
||||
GetPlayer(ClientID)->m_VotedForPractice = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameTeams::SetForceCharacterNewTeam(int ClientID, int Team)
|
||||
{
|
||||
m_Core.Team(ClientID, Team);
|
||||
|
||||
if (m_Core.Team(ClientID) != TEAM_SUPER)
|
||||
|
@ -287,16 +302,6 @@ void CGameTeams::SetForceCharacterTeam(int ClientID, int Team)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (OldTeam != Team)
|
||||
{
|
||||
for(int LoopClientID = 0; LoopClientID < MAX_CLIENTS; ++LoopClientID)
|
||||
if(GetPlayer(LoopClientID))
|
||||
SendTeamsState(LoopClientID);
|
||||
|
||||
if(GetPlayer(ClientID))
|
||||
GetPlayer(ClientID)->m_VotedForPractice = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameTeams::ForceLeaveTeam(int ClientID)
|
||||
|
@ -670,7 +675,10 @@ void CGameTeams::OnCharacterSpawn(int ClientID)
|
|||
m_Core.SetSolo(ClientID, false);
|
||||
|
||||
if (m_Core.Team(ClientID) >= TEAM_SUPER || !m_TeamLocked[m_Core.Team(ClientID)])
|
||||
SetForceCharacterTeam(ClientID, 0);
|
||||
// Important to only set a new team here, don't remove from an existing
|
||||
// team since a newly joined player does by definition not have an old team
|
||||
// to remove from. Doing so would destroy the count in m_MembersCount.
|
||||
SetForceCharacterNewTeam(ClientID, 0);
|
||||
}
|
||||
|
||||
void CGameTeams::OnCharacterDeath(int ClientID, int Weapon)
|
||||
|
|
|
@ -65,13 +65,14 @@ public:
|
|||
|
||||
int Count(int Team) const;
|
||||
|
||||
//need to be very careful using this method
|
||||
void SetForceCharacterTeam(int id, int Team);
|
||||
void ForceLeaveTeam(int id);
|
||||
//need to be very careful using this method. SERIOUSLY...
|
||||
void SetForceCharacterTeam(int ClientID, int Team);
|
||||
void SetForceCharacterNewTeam(int ClientID, int Team);
|
||||
void ForceLeaveTeam(int ClientID);
|
||||
|
||||
void Reset();
|
||||
|
||||
void SendTeamsState(int Cid);
|
||||
void SendTeamsState(int ClientID);
|
||||
void SetTeamLock(int Team, bool Lock);
|
||||
void ResetInvited(int Team);
|
||||
void SetClientInvited(int Team, int ClientID, bool Invited);
|
||||
|
|
Loading…
Reference in a new issue