summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.h
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2009-10-13 03:05:10 -0700
committerSteven Noonan <steven@uplinklabs.net>2009-10-13 06:23:13 -0700
commit997a4469a2022461f5fe011bd7d0843d6dd6c5de (patch)
tree96e1c6a217e1c15852ab651361e8085d0a27e911 /crawl-ref/source/stuff.h
parent3f6c3a3969efce77a980fdf7e3c76183bcad2db3 (diff)
downloadcrawl-ref-997a4469a2022461f5fe011bd7d0843d6dd6c5de.tar.gz
crawl-ref-997a4469a2022461f5fe011bd7d0843d6dd6c5de.zip
fix 'DEBUG' macro usage consistency
Sometimes we were doing #if DEBUG and others we were doing #ifdef DEBUG. If we mix both, we have problems: If the DEBUG macro isn't defined, the statement '#if DEBUG' doesn't really make sense logically, because 'DEBUG' has no value. And if we '#define DEBUG 0', then the '#ifdef DEBUG's become true statements. The easiest fix is to swap out the #ifs with #ifdefs. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/stuff.h')
-rw-r--r--crawl-ref/source/stuff.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h
index 84554a47af..0591c07688 100644
--- a/crawl-ref/source/stuff.h
+++ b/crawl-ref/source/stuff.h
@@ -230,7 +230,7 @@ int choose_random_weighted(Iterator beg, const Iterator end)
{
ASSERT(beg < end);
-#if DEBUG
+#ifdef DEBUG
int times_set = 0;
#endif
@@ -242,14 +242,14 @@ int choose_random_weighted(Iterator beg, const Iterator end)
if (random2(totalweight) < *beg)
{
result = count;
-#if DEBUG
+#ifdef DEBUG
times_set++;
#endif
}
++count;
++beg;
}
-#if DEBUG
+#ifdef DEBUG
ASSERT(times_set > 0);
#endif
return result;