git repos / blockattack-game

commit 344e2b89

sago007 · 2016-01-18 21:33
344e2b8934029e28aa0a7a03e0dd85e55aa79195 patch · browse files
parent b293a0e46cd592a2ad60f12916a3c6046227c65c

The Windows version does now run. It opens a console windows too but that can be fixed later.

Changed files

M CMakeLists.txt before
M source/code/main.cpp before
M source/code/sago/SagoDataHolder.cpp before
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;
}