summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/main.cpp4
-rw-r--r--src/main.h4
-rw-r--r--src/resources/itemmanager.cpp4
-rw-r--r--src/resources/resourcemanager.cpp1
8 files changed, 15 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 47bb0cb5..067736a3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -125,7 +125,9 @@ tmw_SOURCES = graphic/spriteset.cpp \
sound.h
# set the include path found by configure
-INCLUDES= $(all_includes)
+INCLUDES = \
+ $(all_includes) \
+ -DTMW_DATADIR=\""$(pkgdatadir)/"\"
# the library search path.
tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) -lguichan_sdl -lguichan `pkg-config --libs libxml-2.0`
diff --git a/src/game.cpp b/src/game.cpp
index 0f1f0bdb..7e538346 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -945,7 +945,7 @@ void do_parse()
// Warp
case 0x0091:
memset(map_path, '\0', 480);
- strcat(map_path, "data/maps/");
+ strcat(map_path, TMW_DATADIR "data/maps/");
strncat(map_path, RFIFOP(2), 497 - strlen(map_path));
logger.log("Warping to %s (%d, %d)",
map_path, RFIFOW(18), RFIFOW(20));
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 3e5a4b09..31c5298a 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -227,7 +227,7 @@ void CharSelectDialog::serverCharSelect()
}
char_ID = RFIFOL(2);
memset(map_path, '\0', 480);
- strcat(map_path, "data/maps/");
+ strcat(map_path, TMW_DATADIR "data/maps/");
strncat(map_path, RFIFOP(6), 479 - strlen(map_path));
map_address = RFIFOL(22);
map_port = RFIFOW(26);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 625d348f..c9f7e571 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -64,7 +64,7 @@ Gui::Gui(Graphics *graphics):
setTop(guiTop);
// Set global font
- guiFont = new gcn::ImageFont("data/graphics/gui/fixedfont.png",
+ guiFont = new gcn::ImageFont(TMW_DATADIR "data/graphics/gui/fixedfont.png",
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:@"
"!\"$%&/=?^+*#[]{}()<>_;'.,\\|-~`"
);
diff --git a/src/main.cpp b/src/main.cpp
index ed62fe21..c8d71212 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -225,7 +225,7 @@ void init_engine()
screenH = (int)config.getValue("screenheight", 600);
bitDepth = (int)config.getValue("colordepth", 16);
- SDL_WM_SetIcon(IMG_Load("data/icons/tmw-icon.png"), NULL);
+ SDL_WM_SetIcon(IMG_Load(TMW_DATADIR "data/icons/tmw-icon.png"), NULL);
screen = SDL_SetVideoMode(screenW, screenH, bitDepth, displayFlags);
if (screen == NULL) {
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
switch (state) {
case LOGIN:
logger.log("State: LOGIN");
- sound.playMusic("data/music/Ivano(de)Jeanette.ogg");
+ sound.playMusic(TMW_DATADIR "data/music/Ivano(de)Jeanette.ogg");
/*bgm = resman->getMusic("music/Ivano(de)Jeanette.ogg");
bgm->play(-1);*/
login();
diff --git a/src/main.h b/src/main.h
index bf45ec55..95fa99bb 100644
--- a/src/main.h
+++ b/src/main.h
@@ -38,6 +38,10 @@
#include <stdio.h>
#include <memory>
+#ifndef TMW_DATADIR
+#define TMW_DATADIR ""
+#endif
+
#ifdef ERROR
#undef ERROR
#endif
diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp
index 6453b55c..ecccd20c 100644
--- a/src/resources/itemmanager.cpp
+++ b/src/resources/itemmanager.cpp
@@ -40,14 +40,14 @@ ItemManager::ItemManager()
{
// Check that file exists before trying to parse it
std::fstream dbFile;
- dbFile.open("./data/items.xml", std::ios::in);
+ dbFile.open(TMW_DATADIR "data/items.xml", std::ios::in);
if (!dbFile.is_open()) {
logger.log("Cannot find item database!");
return;
}
dbFile.close();
- xmlDocPtr doc = xmlParseFile("./data/items.xml");
+ xmlDocPtr doc = xmlParseFile(TMW_DATADIR "data/items.xml");
if (doc) {
xmlNodePtr node = xmlDocGetRootElement(doc);
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 8606816e..ba990734 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -210,6 +210,7 @@ void ResourceManager::deleteInstance()
void ResourceManager::searchAndAddZipFiles()
{
// Add the main data directory to our PhysicsFS search path
+ PHYSFS_addToSearchPath(TMW_DATADIR "data", 1);
PHYSFS_addToSearchPath("data", 1);
// Define the path in which to search