summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-02-20 08:06:55 (EST)
committer P. J. McDermott <pjm@nac.net>2013-02-20 08:06:55 (EST)
commit2b13c1516e85060dc9cf4fd68fafa7459eee73fc (patch)
tree5b22bdfef91204b93b7db45f350bb8cfff0724f6
parent4c79651326eeabc2a53534a3b8b1b5aff885dd5a (diff)
downloadoverworld-rpg-2b13c1516e85060dc9cf4fd68fafa7459eee73fc.zip
overworld-rpg-2b13c1516e85060dc9cf4fd68fafa7459eee73fc.tar.gz
overworld-rpg-2b13c1516e85060dc9cf4fd68fafa7459eee73fc.tar.bz2
Define installation directory preprocessor macros.
-rw-r--r--Makefile.am2
-rw-r--r--data/maps/Makefile.am2
-rw-r--r--data/tilesets/Makefile.am2
-rw-r--r--src/main.c8
4 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 89ed355..d366f12 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
bin_PROGRAMS = sdlex
+AM_CPPFLAGS =
+
include $(top_srcdir)/src/Makefile.am
include $(top_srcdir)/data/Makefile.am
diff --git a/data/maps/Makefile.am b/data/maps/Makefile.am
index fd7038c..b86328a 100644
--- a/data/maps/Makefile.am
+++ b/data/maps/Makefile.am
@@ -1,5 +1,7 @@
mapsdir = $(pkgdatadir)/maps
+AM_CPPFLAGS += -DMAPSDIR=\"$(mapsdir)\"
+
dist_maps_DATA = \
data/maps/forest1-8bit.tmx \
data/maps/town1.tmx \
diff --git a/data/tilesets/Makefile.am b/data/tilesets/Makefile.am
index 146aad6..ceb0381 100644
--- a/data/tilesets/Makefile.am
+++ b/data/tilesets/Makefile.am
@@ -4,6 +4,8 @@ tilesets_sources = \
tilesetsdir = $(pkgdatadir)/tilesets
+AM_CPPFLAGS += -DTILESETSDIR=\"$(tilesetsdir)\"
+
tilesets_DATA = \
data/tilesets/collision.png \
data/tilesets/mountain_landscape_19-16-8bit.png
diff --git a/src/main.c b/src/main.c
index 8c5463e..3f20335 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,7 +31,13 @@ main(void)
init();
vp = init_viewport(240, 160, 8);
- map = map_get("data/maps/forest1-8bit.tmx");
+ map = map_get(MAPSDIR "/forest1-8bit.tmx");
+ if (map == NULL) {
+ map = map_get("data/maps/forest1-8bit.tmx");
+ }
+ if (map == NULL) {
+ err(1, "Where's the map, George?");
+ }
a = area_new(map);
for (i = 0; i < 256; ++i) {