瀏覽代碼

iOS: don't create unused CConsoleHandler

Andrey Filipenkov 3 年之前
父節點
當前提交
53ac61b52b
共有 5 個文件被更改,包括 17 次插入1 次删除
  1. 6 0
      client/CMT.cpp
  2. 2 0
      launcher/mainwindow_moc.cpp
  3. 5 1
      lib/logging/CLogger.cpp
  4. 2 0
      lib/logging/CLogger.h
  5. 2 0
      server/CVCMIServer.cpp

+ 6 - 0
client/CMT.cpp

@@ -104,7 +104,9 @@ static po::variables_map vm;
 
 //static bool setResolution = false; //set by event handling thread after resolution is adjusted
 
+#ifndef VCMI_IOS
 void processCommand(const std::string &message);
+#endif
 static void setScreenRes(int w, int h, int bpp, bool fullscreen, int displayIndex, bool resetVideo=true);
 void playIntro();
 static void mainLoop();
@@ -236,9 +238,11 @@ int main(int argc, char * argv[])
 	// Init old logging system and new (temporary) logging system
 	CStopWatch total, pomtime;
 	std::cout.flags(std::ios::unitbuf);
+#ifndef VCMI_IOS
 	console = new CConsoleHandler();
 	*console->cb = processCommand;
 	console->start();
+#endif
 
 	const bfs::path logPath = VCMIDirs::get().userLogsPath() / "VCMI_Client_log.txt";
 	logConfig = new CBasicLogConfigurator(logPath, console);
@@ -553,6 +557,7 @@ void removeGUI()
 	LOCPLINT = nullptr;
 }
 
+#ifndef VCMI_IOS
 void processCommand(const std::string &message)
 {
 	std::istringstream readed;
@@ -965,6 +970,7 @@ void processCommand(const std::string &message)
 		LOCPLINT->cb->sendMessage(message);
 	}*/
 }
+#endif
 
 //plays intro, ends when intro is over or button has been pressed (handles events)
 void playIntro()

+ 2 - 0
launcher/mainwindow_moc.cpp

@@ -27,7 +27,9 @@ void MainWindow::load()
 	// This is important on Mac for relative paths to work inside DMG.
 	QDir::setCurrent(QApplication::applicationDirPath());
 
+#ifndef VCMI_IOS
 	console = new CConsoleHandler();
+#endif
 	CBasicLogConfigurator logConfig(VCMIDirs::get().userLogsPath() / "VCMI_Launcher_log.txt", console);
 	logConfig.configureDefault();
 

+ 5 - 1
lib/logging/CLogger.cpp

@@ -346,7 +346,11 @@ EConsoleTextColor::EConsoleTextColor CColorMapping::getColorFor(const CLoggerDom
 	throw std::runtime_error("failed to find color for requested domain/level pair");
 }
 
-CLogConsoleTarget::CLogConsoleTarget(CConsoleHandler * console) : console(console), threshold(ELogLevel::INFO), coloredOutputEnabled(true)
+CLogConsoleTarget::CLogConsoleTarget(CConsoleHandler * console) :
+#ifndef VCMI_IOS
+    console(console),
+#endif
+    threshold(ELogLevel::INFO), coloredOutputEnabled(true)
 {
 	formatter.setPattern("%m");
 }

+ 2 - 0
lib/logging/CLogger.h

@@ -198,7 +198,9 @@ public:
 	void write(const LogRecord & record) override;
 
 private:
+#ifndef VCMI_IOS
 	CConsoleHandler * console;
+#endif
 	ELogLevel::ELogLevel threshold;
 	bool coloredOutputEnabled;
 	CLogFormatter formatter;

+ 2 - 0
server/CVCMIServer.cpp

@@ -935,7 +935,9 @@ int main(int argc, char * argv[])
 	signal(SIGSEGV, handleLinuxSignal);
 #endif
 
+#ifndef VCMI_IOS
 	console = new CConsoleHandler();
+#endif
 	CBasicLogConfigurator logConfig(VCMIDirs::get().userLogsPath() / "VCMI_Server_log.txt", console);
 	logConfig.configureDefault();
 	logGlobal->info(SERVER_NAME);