diff --git a/CMakeLists.txt b/CMakeLists.txt index ce12430..f10007a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,10 @@ set(INSTALL_MAN_DIR "/usr/share/man/man6" CACHE STRING "Install the man page to set(INSTALL_APPLICATIONS_DIR "/usr/share/applications" CACHE STRING "Install the .desktop file to this directory") set(INSTALL_ICONS_DIR "/usr/share/icons/hicolor" CACHE STRING "Install the icon in a subfolder in this directory") +if (!WIN32) #The path to the data dir must be compiled into the binary add_definitions(-DSHAREDIR=\"${INSTALL_DATA_DIR}\") +endif() #Compiler options set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-sign-compare -std=c++11") diff --git a/source/code/main.cpp b/source/code/main.cpp index 050e0d9..d544a03 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -101,6 +101,7 @@ void loadTheme(sago::SagoSpriteHolder& holder, const string& themeName) { PHYSFS_removeFromSearchPath(oldThemePath.c_str()); //Look in blockattack.data PHYSFS_addToSearchPath(((string)SHAREDIR+"/blockattack.data").c_str(), 1); + PHYSFS_addToSearchPath(((string)PHYSFS_getBaseDir()+"/blockattack.data").c_str(), 1); //Look in folder PHYSFS_addToSearchPath( ((string) PHYSFS_getBaseDir()+"/data").c_str(), 1); //Look in home folder diff --git a/source/code/sago/SagoDataHolder.cpp b/source/code/sago/SagoDataHolder.cpp index bfceb0f..a872ea4 100644 --- a/source/code/sago/SagoDataHolder.cpp +++ b/source/code/sago/SagoDataHolder.cpp @@ -188,6 +188,7 @@ Mix_Music* SagoDataHolder::getMusicPtr(const std::string& musicName) const { } std::cout << path << " loaded" << std::endl; data->music[musicName] = ret; + data->dataToFree.push_back(std::move(m_data)); return ret; } @@ -225,6 +226,7 @@ Mix_Chunk* SagoDataHolder::getSoundPtr(const std::string& soundName) const { std::cout << path << " loaded" << std::endl; data->sounds[soundName] = ret; + data->dataToFree.push_back(std::move(m_data)); return ret; }