summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--src/gui/browserbox.cpp4
-rw-r--r--src/main.cpp2
-rw-r--r--src/resources/resourcemanager.cpp7
-rw-r--r--src/resources/resourcemanager.h5
5 files changed, 25 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 32230b5b..8f41d7f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-08-04 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/main.cpp: Use "true" instead of "1" as bool argument.
+ * src/resources/resourcemanager.cpp, src/resources/resourcemanager.h:
+ Added a method to determine the real path of a file in the PhysFS search
+ path.
+ * src/gui/browserbox.cpp: Make use of then new resource manager method to
+ determine the real path of a file.
+
2005-08-03 Andrej Sinicyn <andrej4000@gmail.com>
* src/game.cpp, src/game.h, src/gui/requesttrade.cpp,src/gui/requesttrade.h:
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 58877b6e..52a13763 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -24,6 +24,7 @@
#include <guichan.hpp>
#include "../graphics.h"
#include "../main.h"
+#include "../resources/resourcemanager.h"
#include "browserbox.h"
#include "gui.h"
@@ -45,7 +46,8 @@ BrowserBox::BrowserBox(unsigned int mode):
{
if (useOpenGL) {
browserFont = new gcn::ImageFont(
- TMW_DATADIR "data/graphics/gui/browserfont.png",
+ ResourceManager::getInstance()->getRealPath(
+ "graphics/gui/browserfont.png"),
" abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567"
"89:@!\"$%&/=?^+*#[]{}()<>_;'.,\\|-~`");
diff --git a/src/main.cpp b/src/main.cpp
index 8e068601..df03908f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -170,7 +170,7 @@ void init_engine()
// Add the main data directory to our PhysicsFS search path
resman->addToSearchPath("data", true);
- resman->addToSearchPath(TMW_DATADIR "data", 1);
+ resman->addToSearchPath(TMW_DATADIR "data", true);
// Add zip files to PhysicsFS
resman->searchAndAddArchives("/", ".zip", true);
// Updates, these override other files
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 82029adf..d185b99a 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -118,6 +118,13 @@ bool ResourceManager::isDirectory(const std::string &path)
return PHYSFS_isDirectory(path.c_str());
}
+std::string ResourceManager::getRealPath(const std::string &path)
+{
+ const char *dirSep = PHYSFS_getDirSeparator();
+
+ return std::string(PHYSFS_getRealDir(path.c_str())) + dirSep + path;
+}
+
Resource*
ResourceManager::get(const E_RESOURCE_TYPE &type, const std::string &idPath)
{
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 9db8ccce..fa7d9610 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -96,6 +96,11 @@ class ResourceManager
bool isDirectory(const std::string &path);
/**
+ * Returns the real path to the given path in the PhysFS search path
+ */
+ std::string getRealPath(const std::string &path);
+
+ /**
* Creates a resource and adds it to the resource map. The idPath is
* converted into the appropriate path for the current operating system
* and the resource is loaded.