mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Merge #6156
6156: Swap times should be per player, not per team (fixes #6155) r=Learath2 a=def- <!-- What is the motivation for the changes of this pull request? --> <!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your 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 (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] 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
b36726bbca
|
@ -41,7 +41,6 @@ void CGameTeams::ResetRoundState(int Team)
|
||||||
ResetInvited(Team);
|
ResetInvited(Team);
|
||||||
if(Team != TEAM_SUPER)
|
if(Team != TEAM_SUPER)
|
||||||
ResetSwitchers(Team);
|
ResetSwitchers(Team);
|
||||||
m_aLastSwap[Team] = 0;
|
|
||||||
|
|
||||||
m_aPractice[Team] = false;
|
m_aPractice[Team] = false;
|
||||||
m_aTeamUnfinishableKillTick[Team] = -1;
|
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_VotedForPractice = false;
|
||||||
GameServer()->m_apPlayers[i]->m_SwapTargetsClientID = -1;
|
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();
|
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)
|
void CGameTeams::SwapTeamCharacters(CPlayer *pPrimaryPlayer, CPlayer *pTargetPlayer, int Team)
|
||||||
|
@ -871,7 +871,7 @@ void CGameTeams::SwapTeamCharacters(CPlayer *pPrimaryPlayer, CPlayer *pTargetPla
|
||||||
|
|
||||||
char aBuf[128];
|
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)
|
if(Since < g_Config.m_SvSaveSwapGamesDelay)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf),
|
str_format(aBuf, sizeof(aBuf),
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CGameTeams
|
||||||
uint64_t m_aInvited[NUM_TEAMS];
|
uint64_t m_aInvited[NUM_TEAMS];
|
||||||
bool m_aPractice[NUM_TEAMS];
|
bool m_aPractice[NUM_TEAMS];
|
||||||
std::shared_ptr<CScoreSaveResult> m_apSaveTeamResult[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];
|
bool m_aTeamSentStartWarning[NUM_TEAMS];
|
||||||
// `m_aTeamUnfinishableKillTick` is -1 by default and gets set when a
|
// `m_aTeamUnfinishableKillTick` is -1 by default and gets set when a
|
||||||
// team becomes unfinishable. If the team hasn't entered practice mode
|
// team becomes unfinishable. If the team hasn't entered practice mode
|
||||||
|
|
Loading…
Reference in a new issue