Merge pull request #4895 from def-/pr-practice-load

Reset practice when loading team (fixes #4894)
This commit is contained in:
Dennis Felsing 2022-04-08 01:37:17 +02:00 committed by GitHub
commit 2eb403be93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) if(NumCurrentVotes >= NumRequiredVotes)
{ {
Teams.EnablePractice(Team); Teams.SetPractice(Team, true);
pSelf->SendChatTeam(Team, "Practice mode enabled for your team, happy practicing!"); 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->ChangeTeamState(Team, m_TeamState);
pTeams->SetTeamLock(Team, m_TeamLocked); pTeams->SetTeamLock(Team, m_TeamLocked);
if(m_Practice) pTeams->SetPractice(Team, m_Practice);
pTeams->EnablePractice(Team);
for(int i = m_MembersCount; i-- > 0;) for(int i = m_MembersCount; i-- > 0;)
{ {

View file

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