diff options
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/app.cpp | 12 | ||||
-rw-r--r-- | src/app/pausemanager.cpp | 18 | ||||
-rw-r--r-- | src/app/system.h | 4 | ||||
-rw-r--r-- | src/app/system_linux.cpp | 6 | ||||
-rw-r--r-- | src/app/system_macosx.cpp | 2 | ||||
-rw-r--r-- | src/app/system_windows.cpp | 4 |
6 files changed, 25 insertions, 21 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp index 628b7a9..80f178b 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -146,14 +146,14 @@ CApplication::CApplication() m_kmodState = 0; m_mouseButtonsState = 0; m_trackedKeys = 0; - + m_dataPath = GetSystemUtils()->GetDataPath(); m_langPath = GetSystemUtils()->GetLangPath(); m_savePath = GetSystemUtils()->GetSaveDir(); m_runSceneName = ""; m_runSceneRank = 0; - + m_sceneTest = false; m_language = LANGUAGE_ENV; @@ -389,7 +389,7 @@ bool CApplication::Create() bool defaultValues = false; GetLogger()->Info("Creating CApplication\n"); - + boost::filesystem::path dataPath(m_dataPath); if (! (boost::filesystem::exists(dataPath) && boost::filesystem::is_directory(dataPath)) ) { @@ -400,13 +400,13 @@ bool CApplication::Create() m_exitCode = 1; return false; } - + boost::filesystem::create_directories(m_savePath); boost::filesystem::create_directories(m_savePath+"/mods"); - + LoadModsFromDir(m_dataPath+"/mods"); LoadModsFromDir(m_savePath+"/mods"); - + CResourceManager::AddLocation(m_dataPath, false); CResourceManager::SetSaveLocation(m_savePath); CResourceManager::AddLocation(m_savePath, true); diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp index d357bba..1135126 100644 --- a/src/app/pausemanager.cpp +++ b/src/app/pausemanager.cpp @@ -29,7 +29,7 @@ template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr; CPauseManager::CPauseManager() { m_sound = CApplication::GetInstancePointer()->GetSound(); - + m_pause = PAUSE_NONE; } @@ -40,24 +40,28 @@ CPauseManager::~CPauseManager() void CPauseManager::SetPause(PauseType pause) { - if(pause != PAUSE_NONE) { - if(m_pause != pause) { + if (pause != PAUSE_NONE) + { + if (m_pause != pause) + { CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str()); CRobotMain::GetInstancePointer()->StartPauseMusic(pause); } - + m_pause = pause; - } else + } + else ClearPause(); } void CPauseManager::ClearPause() { - if(m_pause != PAUSE_NONE) { + if(m_pause != PAUSE_NONE) + { CLogger::GetInstancePointer()->Info("Game resumed\n"); m_sound->StopPauseMusic(); } - + m_pause = PAUSE_NONE; } diff --git a/src/app/system.h b/src/app/system.h index 5177815..4b4440f 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -132,10 +132,10 @@ public: //! Returns the data path (containing textures, levels, helpfiles, etc) virtual std::string GetDataPath(); - + //! Returns the translations path virtual std::string GetLangPath(); - + //! Returns the save dir location virtual std::string GetSaveDir(); }; diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index 485d7c2..837c03e 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -25,7 +25,7 @@ void CSystemUtilsLinux::Init() { m_zenityAvailable = true; - if (system("zenity --version") != 0) + if (system("zenity --version >& /dev/null") != 0) { m_zenityAvailable = false; GetLogger()->Warn("Zenity not available, will fallback to console users dialogs.\n"); @@ -98,7 +98,7 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT std::string CSystemUtilsLinux::GetSaveDir() { std::string savegameDir; - + // Determine savegame dir according to XDG Base Directory Specification char *envXDG_DATA_HOME = getenv("XDG_CONFIG_DATA"); if (envXDG_DATA_HOME == NULL) @@ -118,6 +118,6 @@ std::string CSystemUtilsLinux::GetSaveDir() savegameDir = std::string(envXDG_DATA_HOME) + "/colobot"; } GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); - + return savegameDir; } diff --git a/src/app/system_macosx.cpp b/src/app/system_macosx.cpp index 06c67d3..fd29667 100644 --- a/src/app/system_macosx.cpp +++ b/src/app/system_macosx.cpp @@ -101,6 +101,6 @@ std::string CSystemUtilsMacOSX::GetSaveDir() { std::string savegameDir = m_ASPath; GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); - + return savegameDir; } diff --git a/src/app/system_windows.cpp b/src/app/system_windows.cpp index e35f83f..a300bc4 100644 --- a/src/app/system_windows.cpp +++ b/src/app/system_windows.cpp @@ -114,7 +114,7 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str) std::string CSystemUtilsWindows::GetSaveDir() { std::string savegameDir; - + char* envUSERPROFILE = getenv("USERPROFILE"); if (envUSERPROFILE == NULL) { @@ -125,6 +125,6 @@ std::string CSystemUtilsWindows::GetSaveDir() savegameDir = std::string(envUSERPROFILE) + "\\colobot"; } GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); - + return savegameDir; } |