From 2b13c1516e85060dc9cf4fd68fafa7459eee73fc Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 20 Feb 2013 08:06:55 -0500 Subject: Define installation directory preprocessor macros. --- 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) { -- cgit v0.9.1