diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-28 20:39:35 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-28 20:39:35 +0000 |
commit | c19eb264cb55e2b1d373bc879742854921999094 (patch) | |
tree | f92b48b240cd435198c6c949bcc05b40f5e6adbb /crawl-ref/source/dungeon.cc | |
parent | 1d5b5da76795d490b6cd64b35d0c61d19f25b5e9 (diff) | |
download | crawl-ref-c19eb264cb55e2b1d373bc879742854921999094.tar.gz crawl-ref-c19eb264cb55e2b1d373bc879742854921999094.zip |
Fix incorrect trap placing [2133162]. My bad.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7056 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 16e3ebd002..6b4bdda1c6 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -2513,17 +2513,16 @@ static void _place_traps(int level_number) if (ts.type != TRAP_UNASSIGNED) continue; - int tries = 200; - do + int tries; + for (tries = 0; tries < 200; ++tries) { ts.pos.x = random2(GXM); ts.pos.y = random2(GYM); + if (in_bounds(ts.pos) && grd(ts.pos) == DNGN_FLOOR) + break; } - while (in_bounds(ts.pos) - && grd(ts.pos) != DNGN_FLOOR - && --tries > 0); - if (tries <= 0) + if (tries == 200) break; ts.type = random_trap_for_place(level_number); |