summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/nullpo.h13
-rw-r--r--src/map/map.c2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index 52e9fba39..8abeb4af9 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -27,10 +27,23 @@
#include <crtdbg.h>
#endif // !DEFCPP && WIN && !MINGW
#define Assert(EX) assert(EX)
+/**
+ * Reports an assertion failure if the passed expression is false.
+ *
+ * @param EX The expression to test.
+ * @return false if the passed expression is true, false otherwise.
+ */
#define Assert_chk(EX) ( (EX) ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion"), true) )
+/**
+ * Reports an assertion failure (without actually checking it).
+ *
+ * @param EX the expression to report.
+ */
+#define Assert_report(EX) (nullpo->assert_report(__FILE__, __LINE__, __func__, #EX, "failed assertion"))
#else // ! ASSERT_CHECK
#define Assert(EX) (EX)
#define Assert_chk(EX) ((EX), false)
+#define Assert_report(EX) ((void)(EX))
#endif // ASSERT_CHECK
#if defined(NULLPO_CHECK)
diff --git a/src/map/map.c b/src/map/map.c
index 7a0dde260..e1bf5232a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2068,6 +2068,8 @@ uint32 map_race_id2mask(int race)
return RCMASK_NONDEMIPLAYER;
ShowWarning("map_race_id2mask: Invalid race: %d\n", race);
+ Assert_report((race >= RC_FORMLESS && race < RC_NONDEMIPLAYER) || race == RC_ALL);
+
return RCMASK_NONE;
}