summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/coord.h
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-05-29 12:39:03 -0400
committerNeil Moore <neil@s-z.org>2014-05-29 12:39:03 -0400
commit7958666ef717dc3c7821e2f335bb1c5bd296a28a (patch)
tree9d57718f22b4ae3e4f9903c2e81435697c5544e6 /crawl-ref/source/coord.h
parent5eabb2b48608fa54d9d920474504d87f781cea81 (diff)
downloadcrawl-ref-7958666ef717dc3c7821e2f335bb1c5bd296a28a.tar.gz
crawl-ref-7958666ef717dc3c7821e2f335bb1c5bd296a28a.zip
Move ASSERT_IN_BOUNDS to coord.h
Since its expansion called in_bounds().
Diffstat (limited to 'crawl-ref/source/coord.h')
-rw-r--r--crawl-ref/source/coord.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/crawl-ref/source/coord.h b/crawl-ref/source/coord.h
index e7eb162372..0a743986b9 100644
--- a/crawl-ref/source/coord.h
+++ b/crawl-ref/source/coord.h
@@ -64,4 +64,15 @@ coord_def rotate_adjacent(coord_def vector, int direction) PURE;
coord_def clamp_in_bounds(const coord_def &p) PURE;
+#ifdef ASSERTS
+# define ASSERT_IN_BOUNDS(where) \
+ ASSERTM(in_bounds(where), "%s = (%d,%d)", #where, (where).x, (where).y)
+# define ASSERT_IN_BOUNDS_OR_ORIGIN(where) \
+ ASSERTM(in_bounds(where) || (where).origin(), \
+ "%s = (%d,%d)", #where, (where).x, (where).y)
+#else
+# define ASSERT_IN_BOUNDS(where) ((void) 0)
+# define ASSERT_IN_BOUNDS_OR_ORIGIN(where) ((void) 0)
+#endif
+
#endif