summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-27 21:50:25 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-28 10:30:45 -0700
commit500ee24e22aae7b457118d152b4480e99969092e (patch)
treeea0e7e3869a80fbc86cffe97136b926cc7149bdd /src/client.cpp
parent64e742acdb9b0dd9c44bced91766f5ea1aa9de4c (diff)
downloadmana-500ee24e22aae7b457118d152b4480e99969092e.tar.gz
mana-500ee24e22aae7b457118d152b4480e99969092e.tar.bz2
mana-500ee24e22aae7b457118d152b4480e99969092e.tar.xz
mana-500ee24e22aae7b457118d152b4480e99969092e.zip
Make the gui more themeable and distribute two themes
The older gray theme and the new wood theme are available as themes. The gray theme needs some new graphics for hilights. Add a theme option for branding and add path/to/branding/data to the PhysFS search path. Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 9fa61364..a1b7a512 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -249,13 +249,6 @@ Client::Client(const Options &options):
"Exiting.", mLocalDataDir.c_str()));
}
- // Add the local data directory to PhysicsFS search path
- resman->addToSearchPath(mLocalDataDir, false);
-
- // Add the main data directories to our PhysicsFS search path
- if (!options.dataPath.empty())
- resman->addToSearchPath(options.dataPath, true);
- resman->addToSearchPath("data", true);
#if defined __APPLE__
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
@@ -267,10 +260,40 @@ Client::Client(const Options &options):
}
CFRelease(resourcesURL);
strncat(path, "/data", PATH_MAX - 1);
- resman->addToSearchPath(path, true);
+ resman->addToSearchPath(path, false);
+ mPackageDir = path;
+#else
+ resman->addToSearchPath(PKG_DATADIR "data", false);
+ mPackageDir = PKG_DATADIR "data";
+#endif
+
+ resman->addToSearchPath("data", false);
+
+ // Add branding/data to PhysFS search path
+ if (!options.brandingPath.empty())
+ {
+ std::string path = options.brandingPath;
+
+ // Strip blah.mana from the path
+#ifdef WIN32
+ int loc1 = path.find_last_of('/');
+ int loc2 = path.find_last_of('\\');
+ int loc = std::max(loc1, loc2);
#else
- resman->addToSearchPath(PKG_DATADIR "data", true);
+ int loc = path.find_last_of('/');
#endif
+ if (loc > 0)
+ path = path.substr(0, loc + 1);
+
+ resman->addToSearchPath(path + "data", false);
+ }
+
+ // Add the main data directories to our PhysicsFS search path
+ if (!options.dataPath.empty())
+ resman->addToSearchPath(options.dataPath, false);
+
+ // Add the local data directory to PhysicsFS search path
+ resman->addToSearchPath(mLocalDataDir, false);
#ifdef WIN32
static SDL_SysWMinfo pInfo;
@@ -319,6 +342,8 @@ Client::Client(const Options &options):
// Initialize for drawing
graphics->_beginDraw();
+ SkinLoader::prepareThemePath();
+
// Initialize the item shortcuts.
itemShortcut = new ItemShortcut;