changeset 2001:1f3d5bf57ad9

Small cleanup of code, declaring variable closer to where they are really used and so on
author mafm
date Sun, 30 Oct 2011 21:07:13 +0000
parents 1cf949a955fb
children 7ec08c4b808e
files src/gui/application.cpp
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui/application.cpp	Sun Oct 30 19:27:02 2011 +0000
+++ b/src/gui/application.cpp	Sun Oct 30 21:07:13 2011 +0000
@@ -90,10 +90,6 @@
 		return false;
 	}
 
-	// Get the path to use for storing data.
-	// This will be relative to the user directory on the user OS.
-	Ogre::String operationalPath = SumwarsHelper::userPath ();
-
 	// Add the user directory
 	if (PHYSFS_mount (PHYSFS_getUserDir (), 0, 1) == 0)
 	{
@@ -195,29 +191,36 @@
 	}
 #endif
     
+	// Get the path to use for storing data.
+	// This will be relative to the user directory on the user OS.
+	Ogre::String operationalPath = SumwarsHelper::userPath ();
+
 	// Initialize the loggers.
 	LogManager::instance ().addLog ("stdout",new StdOutLog (Log::LOGLEVEL_DEBUG));
-    LogManager::instance ().addLog ("logfile",new FileLog (operationalPath + "/sumwars.log", Log::LOGLEVEL_DEBUG));
+	LogManager::instance ().addLog ("logfile",new FileLog (operationalPath + "/sumwars.log", Log::LOGLEVEL_DEBUG));
 
 	Timer tm;
 	m_timer.start();
-	bool ret = true;
 
 	// Ogre Root erzeugen
 	// pluginfile: plugins.cfg
 	// configfile: keines
-#ifdef _WIN32
+#if defined (_WIN32)
 	m_ogre_root = new Ogre::Root (operationalPath + "/plugins.cfg", operationalPath + "/ogre.cfg", operationalPath + "/ogre.log");
-#elif defined __APPLE__
-    Ogre::String plugins = macPath();
+#elif defined (__APPLE__)
+	Ogre::String plugins = macPath();
 	m_ogre_root = new Ogre::Root(plugins + "/plugins_mac.cfg", plugins + "/ogre.cfg", operationalPath + "/ogre.log");
 #else
-	m_ogre_root = new Ogre::Root(CFG_FILES_DIR "/plugins.cfg", CFG_FILES_DIR "/ogre.cfg", operationalPath + "/Ogre.log");
+	m_ogre_root = new Ogre::Root(SumwarsHelper::gameDataPath() + "/plugins.cfg",
+				     SumwarsHelper::gameDataPath() + "/ogre.cfg",
+				     SumwarsHelper::userPath() + "/Ogre.log");
 #endif
 
-	if (m_ogre_root ==0)
+	if (m_ogre_root == 0)
 		return false;
 
+	bool ret = true;
+
 	// Ogre configurieren
 	ret = configureOgre();
 	if (ret==false)