summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-15 14:25:08 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-15 14:25:08 +0000
commit173d629a2374eb0b55821e0cf972dcd7ae34c2da (patch)
tree448047ef50b3a75d17327fae87b5fe7a698838a1 /crawl-ref/source/dungeon.cc
parent596ebde4635e759bad9ad31dacab285e57b1936b (diff)
downloadcrawl-ref-173d629a2374eb0b55821e0cf972dcd7ae34c2da.tar.gz
crawl-ref-173d629a2374eb0b55821e0cf972dcd7ae34c2da.zip
Fix 2082716: clean colour tags from dumps.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6934 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 7094d221a1..f6cc5ddabd 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2447,48 +2447,45 @@ static bool _shaft_is_in_corridor(const coord_def& c)
static void _place_traps(int level_number)
{
- int i;
- int num_traps = num_traps_for_place(level_number);
+ const int num_traps = num_traps_for_place(level_number);
ASSERT(num_traps >= 0);
ASSERT(num_traps <= MAX_TRAPS);
- for (i = 0; i < num_traps; i++)
+ for (int i = 0; i < num_traps; i++)
{
- // Traps can be placed in vaults.
- if (env.trap[i].type != TRAP_UNASSIGNED)
+ trap_struct& ts(env.trap[i]);
+ if (ts.type != TRAP_UNASSIGNED)
continue;
int tries = 200;
do
{
- env.trap[i].pos.x = random2(GXM);
- env.trap[i].pos.y = random2(GYM);
+ ts.pos.x = random2(GXM);
+ ts.pos.y = random2(GYM);
}
- while (grd(env.trap[i].pos) != DNGN_FLOOR
+ while (in_bounds(ts.pos)
+ && grd(ts.pos) != DNGN_FLOOR
&& --tries > 0);
if (tries <= 0)
break;
- trap_type &trap_type = env.trap[i].type;
- trap_type = random_trap_for_place(level_number);
-
- if (trap_type == TRAP_SHAFT && level_number <= 7)
+ ts.type = random_trap_for_place(level_number);
+ if (ts.type == TRAP_SHAFT && level_number <= 7)
{
// Disallow shaft construction in corridors!
- if ( _shaft_is_in_corridor(env.trap[i].pos) )
+ if ( _shaft_is_in_corridor(ts.pos) )
{
// Choose again!
- trap_type = random_trap_for_place(level_number);
+ ts.type = random_trap_for_place(level_number);
// If we get shaft a second time, turn it into an alarm trap.
- if (trap_type == TRAP_SHAFT)
- trap_type = TRAP_ALARM;
+ if (ts.type == TRAP_SHAFT)
+ ts.type = TRAP_ALARM;
}
}
-
- grd(env.trap[i].pos) = DNGN_UNDISCOVERED_TRAP;
+ grd(ts.pos) = DNGN_UNDISCOVERED_TRAP;
}
}