1
0

Merge pull request #3137 from cuberite/issue3136

Issue3136
This commit is contained in:
Alexander Harkness 2016-04-13 07:05:11 +01:00
commit 8447e4e333
3 changed files with 14 additions and 27 deletions

View File

@ -963,6 +963,3 @@ AStringVector ReadUpgradeIniPorts(
return Ports;
}

View File

@ -108,31 +108,26 @@ 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 ;});
std::vector<std::pair<AString, AString>> ret;
auto ret = overrides;
size_t overridesIndex = 0;
for (auto pair : main)
for (const auto & mainpair : main)
{
if (overridesIndex >= overrides.size())
bool found = false;
for (const auto & returnpair : ret)
{
ret.push_back(pair);
continue;
if (returnpair.first == mainpair.first)
{
found = true;
break;
}
}
if (pair.first == overrides[overridesIndex].first)
if (found == false)
{
continue;
ret.push_back(mainpair);
}
while (pair.first > overrides[overridesIndex].first)
{
ret.push_back(overrides[overridesIndex]);
overridesIndex++;
}
ret.push_back(pair);
}
return ret;
}
@ -270,4 +265,3 @@ bool cOverridesSettingsRepository::Flush()
{
return m_Overrides->Flush() && m_Main->Flush();
}

View File

@ -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 number the server should listen to", false, "port", cmd);
TCLAP::MultiArg<int> portsArg ("p", "port", "The port numbers 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", "Port", static_cast<Int64>(port));
repo->AddValue("Server", "Ports", static_cast<Int64>(port));
}
}
if (commLogArg.getValue())
@ -555,7 +555,3 @@ int main(int argc, char ** argv)
return EXIT_SUCCESS;
}