Warnings improvements
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality
* Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already
* Reduced GetStackValue verbosity
+ Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness
+ Give SettingsRepositoryInterface a move constructor to simplify main.cpp code
- Remove do {} while (false) construction in redstone handler
This commit is contained in:
21
src/main.cpp
21
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:
|
||||
|
||||
Reference in New Issue
Block a user