Fix max slots logic to only override if acctually present.
This commit is contained in:
parent
36fe8ee5f5
commit
c2303ac4cf
13
src/main.cpp
13
src/main.cpp
@ -373,12 +373,17 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
|
||||
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);
|
||||
|
||||
cmd.parse(argc, argv);
|
||||
|
||||
int slots = slotsArg.getValue();
|
||||
|
||||
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
|
||||
|
||||
repo->SetValueI("Server", "MaxPlayers", slots);
|
||||
if (slotsArg.isSet())
|
||||
{
|
||||
|
||||
int slots = slotsArg.getValue();
|
||||
|
||||
repo->SetValueI("Server", "MaxPlayers", slots);
|
||||
|
||||
}
|
||||
|
||||
repo->SetReadOnly();
|
||||
|
||||
@ -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>();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user