Reset practice when loading team (fixes #4894)

I hope this doesn't give a chance to cheat. We also reset practice when
killing a team, so loading can be considered as similar to killing?
This commit is contained in:
Dennis Felsing 2022-03-25 10:09:45 +01:00
parent ebc714fa7f
commit b96b23d9cb
3 changed files with 4 additions and 5 deletions

View file

@ -667,7 +667,7 @@ void CGameContext::ConPractice(IConsole::IResult *pResult, void *pUserData)
if(NumCurrentVotes >= NumRequiredVotes)
{
Teams.EnablePractice(Team);
Teams.SetPractice(Team, true);
pSelf->SendChatTeam(Team, "Practice mode enabled for your team, happy practicing!");
}
}

View file

@ -517,8 +517,7 @@ void CSaveTeam::Load(int Team, bool KeepCurrentWeakStrong)
pTeams->ChangeTeamState(Team, m_TeamState);
pTeams->SetTeamLock(Team, m_TeamLocked);
if(m_Practice)
pTeams->EnablePractice(Team);
pTeams->SetPractice(Team, m_Practice);
for(int i = m_MembersCount; i-- > 0;)
{

View file

@ -183,14 +183,14 @@ public:
return m_pSaveTeamResult[TeamID] != nullptr;
}
void EnablePractice(int Team)
void SetPractice(int Team, bool Enabled)
{
if(Team < TEAM_FLOCK || Team >= TEAM_SUPER)
return;
if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team == TEAM_FLOCK)
return;
m_Practice[Team] = true;
m_Practice[Team] = Enabled;
}
bool IsPractice(int Team)