Bläddra i källkod

let vcmiserver handle commandline options first

The vcmiserver application will first try to initialize various things
before parsing the commandline arguments. This leads to the program only
outputting an initialization error when it cannot initialize instead of
parsing arguments like --help. This patch moves the argument parsing to
earlier in program execution to avoid this behaviour.
josch 11 år sedan
förälder
incheckning
2e6e026645
1 ändrade filer med 4 tillägg och 4 borttagningar
  1. 4 4
      server/CVCMIServer.cpp

+ 4 - 4
server/CVCMIServer.cpp

@@ -599,14 +599,14 @@ int main(int argc, char** argv)
 	CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() + "/VCMI_Server_log.txt", console);
 	CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() + "/VCMI_Server_log.txt", console);
 	logConfig.configureDefault();
 	logConfig.configureDefault();
 
 
-	preinitDLL(console);
-    settings.init();
-	logConfig.configure();
-
 	handleCommandOptions(argc, argv);
 	handleCommandOptions(argc, argv);
 	port = cmdLineOptions["port"].as<int>();
 	port = cmdLineOptions["port"].as<int>();
 	logNetwork->infoStream() << "Port " << port << " will be used.";
 	logNetwork->infoStream() << "Port " << port << " will be used.";
 
 
+	preinitDLL(console);
+	settings.init();
+	logConfig.configure();
+
 	loadDLLClasses();
 	loadDLLClasses();
 	srand ( (ui32)time(nullptr) );
 	srand ( (ui32)time(nullptr) );
 	try
 	try