diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-10-05 14:09:42 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-12-18 22:03:40 +0100 |
commit | 090d8305e4e3c3ee085a897b72f2b4708e183eb8 (patch) | |
tree | e703cc7fcb7f16c85f16b094d5df0bd0a8d698e8 /src/main.cpp | |
parent | Horsies: don't always broadcast metadata (diff) | |
download | cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.gz cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.bz2 cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.lz cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.xz cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.tar.zst cuberite-090d8305e4e3c3ee085a897b72f2b4708e183eb8.zip |
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp index cb7633df3..86f0aa359 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -86,7 +86,7 @@ static void NonCtrlHandler(int a_Signal) case SIGTERM: { // Server is shutting down, wait for it... - cRoot::Get()->Stop(); + cRoot::Stop(); return; } #ifdef SIGPIPE @@ -111,7 +111,7 @@ static void NonCtrlHandler(int a_Signal) // Handle CTRL events in windows, including console window close static BOOL CtrlHandler(DWORD fdwCtrlType) { - cRoot::Get()->Stop(); + cRoot::Stop(); LOGD("Terminate event raised from the Windows CtrlHandler"); // Delay as much as possible to try to get the server to shut down cleanly - 10 seconds given by Windows @@ -130,7 +130,7 @@ static BOOL CtrlHandler(DWORD fdwCtrlType) //////////////////////////////////////////////////////////////////////////////// // ParseArguments - Read the startup arguments and store into a settings object -static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & repo) +static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & Settings) { // Parse the comand line args: TCLAP::CmdLine cmd("Cuberite"); @@ -151,23 +151,23 @@ static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & r if (confArg.isSet()) { AString conf_file = confArg.getValue(); - repo.AddValue("Server", "ConfigFile", conf_file); + Settings.AddValue("Server", "ConfigFile", conf_file); } if (slotsArg.isSet()) { int slots = slotsArg.getValue(); - repo.AddValue("Server", "MaxPlayers", static_cast<Int64>(slots)); + Settings.AddValue("Server", "MaxPlayers", static_cast<Int64>(slots)); } if (portsArg.isSet()) { for (auto port: portsArg.getValue()) { - repo.AddValue("Server", "Ports", std::to_string(port)); + Settings.AddValue("Server", "Ports", std::to_string(port)); } } if (noFileLogArg.getValue()) { - repo.AddValue("Server", "DisableLogFile", true); + Settings.AddValue("Server", "DisableLogFile", true); } if (commLogArg.getValue()) { @@ -183,7 +183,7 @@ static void ParseArguments(int argc, char ** argv, cMemorySettingsRepository & r { setvbuf(stdout, nullptr, _IONBF, 0); } - repo.SetReadOnly(); + Settings.SetReadOnly(); if (runAsServiceArg.getValue()) { @@ -230,11 +230,10 @@ static int UniversalMain(int argc, char * argv[], bool RunningAsService) try { - // Make sure g_RunAsService is set correctly before checking it's value cMemorySettingsRepository Settings; - ParseArguments(argc, argv, Settings); + ParseArguments(argc, argv, Settings); // Make sure g_RunAsService is set correctly before checking it's value - // Attempt to run as a service + // Attempt to run as a service: if (!RunningAsService && g_RunAsService) { // This will either fork or call UniversalMain again: |