git repos / blockattack-game

commit 012af19d

sago007 · 2016-01-25 17:42
012af19d5efb8ec8f9dd03f0162fc114624c4c2c patch · browse files
parent 63c773dd9b1ce7b314a4abe111837f93fccb58fd

Moved the load things a bit and removed the old theme support

Changed files

M source/code/main.cpp before
diff --git a/source/code/main.cpp b/source/code/main.cpp index beaffc7..f183203 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -93,31 +93,15 @@ using namespace std;
static int InitImages(sago::SagoSpriteHolder& holder);
-static string oldThemePath = "default";
-
-void loadTheme(sago::SagoSpriteHolder& holder, const string& themeName) {
- string home = getPathToSaveFiles();
- //Remove old theme
- PHYSFS_removeFromSearchPath(oldThemePath.c_str());
+static void PhysFsSetSearchPath() {
//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
+ string home = getPathToSaveFiles();
PHYSFS_addToSearchPath(home.c_str(), 1);
- if (themeName == Config::getInstance()->getString("themename")) {
- //If this is a theme different from the saved one. Remember it!
- Config::getInstance()->setString("themename", themeName);
- }
- if (themeName.compare("default")==0 || (themeName.compare("start")==0)) {
- InitImages(holder);
- return; //Nothing more to do
- }
- oldThemePath = "themes/"+themeName;
- PHYSFS_addToSearchPath(oldThemePath.c_str(),0);
- PHYSFS_addToSearchPath((home+(string)"/"+oldThemePath).c_str(), 0);
- InitImages(holder);
}
@@ -2030,13 +2014,11 @@ int main(int argc, char* argv[]) {
screen = renderer;
//Init the file system abstraction layer
PHYSFS_init(argv[0]);
- PHYSFS_addToSearchPath(((string)SHAREDIR+"/blockattack.data").c_str(), 1);
- PHYSFS_addToSearchPath( ((string) PHYSFS_getBaseDir()+"/data").c_str(), 1);
- //Load default theme
+ PhysFsSetSearchPath();
sago::SagoDataHolder d(renderer);
d.setVerbose(false);
sago::SagoSpriteHolder spriteholder(d);
- loadTheme(spriteholder, Config::getInstance()->getString("themename"));
+ InitImages(spriteholder);
SetSDLIcon(sdlWindow);
if (verboseLevel) {