From c19eb264cb55e2b1d373bc879742854921999094 Mon Sep 17 00:00:00 2001 From: haranp Date: Sun, 28 Sep 2008 20:39:35 +0000 Subject: 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 --- crawl-ref/source/dungeon.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source/dungeon.cc') 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); -- cgit v1.2.3-54-g00ecf