diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index b1676ed14..4761daf64 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -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; } } } @@ -861,7 +861,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) @@ -871,7 +871,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), diff --git a/src/game/server/teams.h b/src/game/server/teams.h index e43cb0b97..c1d593b8f 100644 --- a/src/game/server/teams.h +++ b/src/game/server/teams.h @@ -28,7 +28,7 @@ class CGameTeams uint64_t m_aInvited[NUM_TEAMS]; bool m_aPractice[NUM_TEAMS]; std::shared_ptr 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