summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-07 18:30:13 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-07 18:39:37 +1000
commit7a14cd46a6ef20eccf81ee4a3842f6d25e53c582 (patch)
treea12e59f347e86f18f3e874eeb578308b3c1fb931 /crawl-ref/source/dungeon.cc
parentaf6becb7a7f2e997daed1a7ecbb08757384ce45b (diff)
downloadcrawl-ref-7a14cd46a6ef20eccf81ee4a3842f6d25e53c582.tar.gz
crawl-ref-7a14cd46a6ef20eccf81ee4a3842f6d25e53c582.zip
Keep trying until we get a valid trap.
random_trap_for_place defaults to NUM_TRAPS; none of the functions that it calls currently do, but others might.
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index a5be8429f8..b1acc696be 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3161,7 +3161,9 @@ static void _place_traps(int level_number)
if (tries == 200)
break;
- ts.type = random_trap_for_place(level_number);
+ while (ts.type >= NUM_TRAPS)
+ ts.type = random_trap_for_place(level_number);
+
if (ts.type == TRAP_SHAFT && level_number <= 7)
{
// Disallow shaft construction in corridors!