Fix max slots logic to only override if acctually present.

This commit is contained in:
tycho 2015-05-18 15:43:26 +01:00
parent 36fe8ee5f5
commit c2303ac4cf

View File

@ -374,12 +374,17 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
cmd.parse(argc, argv);
int slots = slotsArg.getValue();
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
if (slotsArg.isSet())
{
int slots = slotsArg.getValue();
repo->SetValueI("Server", "MaxPlayers", slots);
}
repo->SetReadOnly();
return repo;
@ -387,7 +392,7 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
catch (TCLAP::ArgException &e)
{
printf("error reading command line %s for arg %s", e.error().c_str(), e.argId().c_str());
return nullptr;
return cpp14::make_unique<cMemorySettingsRepository>();
}
}