diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 7ab5881df..0d75dfb8d 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -644,6 +644,15 @@ void CGameContext::ConPractice(IConsole::IResult *pResult, void *pUserData) return; } + if(Teams.GetSaving(Team)) + { + pSelf->Console()->Print( + IConsole::OUTPUT_LEVEL_STANDARD, + "chatresp", + "Practice mode can't be enabled while team save or load is in progress"); + return; + } + if(Teams.IsPractice(Team)) { pSelf->Console()->Print( diff --git a/src/game/server/score.cpp b/src/game/server/score.cpp index dedb1eb1a..912238781 100644 --- a/src/game/server/score.cpp +++ b/src/game/server/score.cpp @@ -288,10 +288,17 @@ void CScore::SaveTeam(int ClientId, const char *pCode, const char *pServer) return; auto *pController = GameServer()->m_pController; int Team = pController->Teams().m_Core.Team(ClientId); + char aBuf[512]; if(pController->Teams().GetSaving(Team)) + { + GameServer()->SendChatTarget(ClientId, "Team save already in progress"); return; + } if(pController->Teams().IsPractice(Team)) + { + GameServer()->SendChatTarget(ClientId, "Team save disabled for teams in practice mode"); return; + } auto SaveResult = std::make_shared(ClientId); SaveResult->m_SaveId = RandomUuid(); @@ -308,7 +315,6 @@ void CScore::SaveTeam(int ClientId, const char *pCode, const char *pServer) Tmp->m_aGeneratedCode[0] = '\0'; GeneratePassphrase(Tmp->m_aGeneratedCode, sizeof(Tmp->m_aGeneratedCode)); - char aBuf[512]; if(Tmp->m_aCode[0] == '\0') { str_format(aBuf, @@ -336,7 +342,10 @@ void CScore::LoadTeam(const char *pCode, int ClientId) auto *pController = GameServer()->m_pController; int Team = pController->Teams().m_Core.Team(ClientId); if(pController->Teams().GetSaving(Team)) + { + GameServer()->SendChatTarget(ClientId, "Team load already in progress"); return; + } if(Team < TEAM_FLOCK || Team >= MAX_CLIENTS || (g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team == TEAM_FLOCK)) { GameServer()->SendChatTarget(ClientId, "You have to be in a team (from 1-63)"); @@ -352,6 +361,11 @@ void CScore::LoadTeam(const char *pCode, int ClientId) GameServer()->SendChatTarget(ClientId, "Team can't be loaded while in team 0 mode"); return; } + if(pController->Teams().IsPractice(Team)) + { + GameServer()->SendChatTarget(ClientId, "Team can't be loaded while practice is enabled"); + return; + } auto SaveResult = std::make_shared(ClientId); SaveResult->m_Status = CScoreSaveResult::LOAD_FAILED; pController->Teams().SetSaving(Team, SaveResult);