diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-04-14 11:40:46 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-04-14 11:40:46 +0200 |
commit | df145ca0f391839aefbff7be9fd8353840127d60 (patch) | |
tree | 53931e6b54099e102786612400ef3a75375b2b04 /src | |
parent | Merge pull request #3139 from LogicParrot/freezeFix (diff) | |
download | cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar.gz cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar.bz2 cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar.lz cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar.xz cuberite-df145ca0f391839aefbff7be9fd8353840127d60.tar.zst cuberite-df145ca0f391839aefbff7be9fd8353840127d60.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/IniFile.cpp | 3 | ||||
-rw-r--r-- | src/OverridesSettingsRepository.cpp | 30 | ||||
-rw-r--r-- | src/main.cpp | 8 |
3 files changed, 27 insertions, 14 deletions
diff --git a/src/IniFile.cpp b/src/IniFile.cpp index 6b9bc9951..4a1c8e735 100644 --- a/src/IniFile.cpp +++ b/src/IniFile.cpp @@ -963,3 +963,6 @@ AStringVector ReadUpgradeIniPorts( return Ports; } + + + diff --git a/src/OverridesSettingsRepository.cpp b/src/OverridesSettingsRepository.cpp index f3db96a5c..9e85abce6 100644 --- a/src/OverridesSettingsRepository.cpp +++ b/src/OverridesSettingsRepository.cpp @@ -108,26 +108,31 @@ std::vector<std::pair<AString, AString>> cOverridesSettingsRepository::GetValues { auto overrides = m_Overrides->GetValues(a_keyName); auto main = m_Main->GetValues(a_keyName); + std::sort(overrides.begin(), overrides.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;}); + std::sort(main.begin(), main.end(), [](std::pair<AString, AString> a, std::pair<AString, AString> b) -> bool { return a < b ;}); - auto ret = overrides; + std::vector<std::pair<AString, AString>> ret; - for (const auto & mainpair : main) + + size_t overridesIndex = 0; + for (auto pair : main) { - bool found = false; - for (const auto & returnpair : ret) + if (overridesIndex >= overrides.size()) + { + ret.push_back(pair); + continue; + } + if (pair.first == overrides[overridesIndex].first) { - if (returnpair.first == mainpair.first) - { - found = true; - break; - } + continue; } - if (found == false) + while (pair.first > overrides[overridesIndex].first) { - ret.push_back(mainpair); + ret.push_back(overrides[overridesIndex]); + overridesIndex++; } + ret.push_back(pair); } - return ret; } @@ -265,3 +270,4 @@ bool cOverridesSettingsRepository::Flush() { return m_Overrides->Flush() && m_Main->Flush(); } + diff --git a/src/main.cpp b/src/main.cpp index 2c277d732..76af90cde 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -371,7 +371,7 @@ static std::unique_ptr<cMemorySettingsRepository> ParseArguments(int argc, char // Parse the comand line args: TCLAP::CmdLine cmd("Cuberite"); TCLAP::ValueArg<int> slotsArg ("s", "max-players", "Maximum number of slots for the server to use, overrides setting in setting.ini", false, -1, "number", cmd); - TCLAP::MultiArg<int> portsArg ("p", "port", "The port numbers the server should listen to", false, "port", cmd); + TCLAP::MultiArg<int> portsArg ("p", "port", "The port number the server should listen to", false, "port", cmd); TCLAP::SwitchArg commLogArg ("", "log-comm", "Log server client communications to file", cmd); TCLAP::SwitchArg commLogInArg ("", "log-comm-in", "Log inbound server client communications to file", cmd); TCLAP::SwitchArg commLogOutArg ("", "log-comm-out", "Log outbound server client communications to file", cmd); @@ -392,7 +392,7 @@ static std::unique_ptr<cMemorySettingsRepository> ParseArguments(int argc, char { for (auto port: portsArg.getValue()) { - repo->AddValue("Server", "Ports", static_cast<Int64>(port)); + repo->AddValue("Server", "Port", static_cast<Int64>(port)); } } if (commLogArg.getValue()) @@ -555,3 +555,7 @@ int main(int argc, char ** argv) return EXIT_SUCCESS; } + + + + |