summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-18 17:04:27 +0200
committertycho <work.tycho@gmail.com>2015-05-18 18:26:12 +0200
commit2e98bfc4e98c1cb0730514628d501c2ca0326c4e (patch)
treef1f428fa8c201e19d6ac3e60e35a5693fc711696 /src/main.cpp
parentFix max slots logic to only override if acctually present. (diff)
downloadcuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar.gz
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar.bz2
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar.lz
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar.xz
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.tar.zst
cuberite-2e98bfc4e98c1cb0730514628d501c2ca0326c4e.zip
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 2cf4b383e..8a237b8ee 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -372,6 +372,8 @@ 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);
+ TCLAP::MultiArg<int> portsArg("p", "port", "The port number the server should listen to", false, "port", cmd);
+
cmd.parse(argc, argv);
auto repo = cpp14::make_unique<cMemorySettingsRepository>();
@@ -381,8 +383,17 @@ std::unique_ptr<cMemorySettingsRepository> parseArguments(int argc, char **argv)
int slots = slotsArg.getValue();
- repo->SetValueI("Server", "MaxPlayers", slots);
+ repo->AddValue("Server", "MaxPlayers", static_cast<Int64>(slots));
+
+ }
+ if (portsArg.isSet())
+ {
+ std::vector<int> ports = portsArg.getValue();
+ for (auto port : ports)
+ {
+ repo->AddValue("Server", "Port", static_cast<Int64>(port));
+ }
}
repo->SetReadOnly();