summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/random.h
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2013-11-22 16:01:46 -0500
committerNeil Moore <neil@s-z.org>2013-11-22 16:11:32 -0500
commit7bac31ae84bf0dd69627f7eda5359d8be27a3004 (patch)
treeee3c667e315e6cb1cd40b4d6e5a886ee04fee6c2 /crawl-ref/source/random.h
parent1a95c093fcb570e4ead25b96505074f3b958eb29 (diff)
downloadcrawl-ref-7bac31ae84bf0dd69627f7eda5359d8be27a3004.tar.gz
crawl-ref-7bac31ae84bf0dd69627f7eda5359d8be27a3004.zip
Remove an error-prone dice_def constructor.
It had a constructor with two optional ints, defaulting to zero. Unfortunately, since we can't rely on C++11's explicit keyword, this meant that dice_def foo = 7; would "work", rolling 7d0. The user probably expected 7d1, but rather than doing that just remove the argument defaults altogether, and add a separate default constructor. One replaced call used beam.damage = INSTANT_DEATH as a "convenient non-zero", but since INSTANT_DEATH is negative, even something like dice_def(INSTANT_DEATH, 1) would result in a negative roll. Use 42d1 instead.
Diffstat (limited to 'crawl-ref/source/random.h')
-rw-r--r--crawl-ref/source/random.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/crawl-ref/source/random.h b/crawl-ref/source/random.h
index b7964d4db3..794edf3be2 100644
--- a/crawl-ref/source/random.h
+++ b/crawl-ref/source/random.h
@@ -99,7 +99,8 @@ struct dice_def
int num;
int size;
- dice_def(int n = 0, int s = 0) : num(n), size(s) {}
+ dice_def() : num(0), size(0) {}
+ dice_def(int n, int s) : num(n), size(s) {}
int roll() const;
};