mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Swap times should be per player, not per team (fixes #6155)
This commit is contained in:
parent
c4fdf20df9
commit
bd815a0507
|
@ -41,7 +41,6 @@ void CGameTeams::ResetRoundState(int Team)
|
|||
ResetInvited(Team);
|
||||
if(Team != TEAM_SUPER)
|
||||
ResetSwitchers(Team);
|
||||
m_aLastSwap[Team] = 0;
|
||||
|
||||
m_aPractice[Team] = false;
|
||||
m_aTeamUnfinishableKillTick[Team] = -1;
|
||||
|
@ -51,6 +50,7 @@ void CGameTeams::ResetRoundState(int Team)
|
|||
{
|
||||
GameServer()->m_apPlayers[i]->m_VotedForPractice = false;
|
||||
GameServer()->m_apPlayers[i]->m_SwapTargetsClientID = -1;
|
||||
m_aLastSwap[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ void CGameTeams::RequestTeamSwap(CPlayer *pPlayer, CPlayer *pTargetPlayer, int T
|
|||
}
|
||||
|
||||
pPlayer->m_SwapTargetsClientID = pTargetPlayer->GetCID();
|
||||
m_aLastSwap[Team] = Server()->Tick();
|
||||
m_aLastSwap[pPlayer->GetCID()] = Server()->Tick();
|
||||
}
|
||||
|
||||
void CGameTeams::SwapTeamCharacters(CPlayer *pPrimaryPlayer, CPlayer *pTargetPlayer, int Team)
|
||||
|
@ -867,7 +867,7 @@ void CGameTeams::SwapTeamCharacters(CPlayer *pPrimaryPlayer, CPlayer *pTargetPla
|
|||
|
||||
char aBuf[128];
|
||||
|
||||
int Since = (Server()->Tick() - m_aLastSwap[Team]) / Server()->TickSpeed();
|
||||
int Since = (Server()->Tick() - m_aLastSwap[pTargetPlayer->GetCID()]) / Server()->TickSpeed();
|
||||
if(Since < g_Config.m_SvSaveSwapGamesDelay)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
|
|
|
@ -28,7 +28,7 @@ class CGameTeams
|
|||
uint64_t m_aInvited[NUM_TEAMS];
|
||||
bool m_aPractice[NUM_TEAMS];
|
||||
std::shared_ptr<CScoreSaveResult> m_apSaveTeamResult[NUM_TEAMS];
|
||||
uint64_t m_aLastSwap[NUM_TEAMS];
|
||||
uint64_t m_aLastSwap[MAX_CLIENTS]; // index is id of player who initiated swap
|
||||
bool m_aTeamSentStartWarning[NUM_TEAMS];
|
||||
// `m_aTeamUnfinishableKillTick` is -1 by default and gets set when a
|
||||
// team becomes unfinishable. If the team hasn't entered practice mode
|
||||
|
|
Loading…
Reference in a new issue