diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index e035cfeeb4..e271d1dbce 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -968,8 +968,8 @@ bool CGame::Start(int iArgumentCount, char* szArguments[]) // Set the Rules loaded from config std::map rulesMap = m_pMainConfig->GetRulesForASE(); - for (const auto& rule : rulesMap) - m_pASE->SetRuleValue(rule.first, rule.second); + for (const auto& [key, value] : rulesMap) + m_pASE->SetRuleValue(key, value); } ApplyAseSetting(); diff --git a/Server/mods/deathmatch/logic/CMainConfig.cpp b/Server/mods/deathmatch/logic/CMainConfig.cpp index 559657fed4..19589fd7a5 100644 --- a/Server/mods/deathmatch/logic/CMainConfig.cpp +++ b/Server/mods/deathmatch/logic/CMainConfig.cpp @@ -136,25 +136,17 @@ bool CMainConfig::Load() // Grab rules CXMLNode* pNode = nullptr; std::size_t uiCurrentIndex = 0; - do + while (pNode = m_pRootNode->FindSubNode("rule", uiCurrentIndex++)) { - // Grab the current script node - pNode = m_pRootNode->FindSubNode("rule", uiCurrentIndex++); - if (pNode) - { - // Grab its "name" attribute - CXMLAttribute* pAttribute = pNode->GetAttributes().Find("name"); - SString strName = pAttribute ? pAttribute->GetValue() : SString{}; + CXMLAttribute* pAttribute = pNode->GetAttributes().Find("name"); + SString strName = pAttribute ? pAttribute->GetValue() : SString{}; - // Grab its "value" attribute - pAttribute = pNode->GetAttributes().Find("value"); - SString strValue = pAttribute ? pAttribute->GetValue() : SString{}; + pAttribute = pNode->GetAttributes().Find("value"); + SString strValue = pAttribute ? pAttribute->GetValue() : SString{}; - // Ignore if name or value are empty - if (!strName.empty() && !strValue.empty()) - m_RulesForASEMap[std::move(strName)] = std::move(strValue); - } - } while (pNode); + if (!strName.empty() && !strValue.empty()) + m_RulesForASEMap[std::move(strName)] = std::move(strValue); + } // Grab the forced server ip(s) GetString(m_pRootNode, "serverip", m_strServerIP);