git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4985 c06c8d41-db1a-0410-9941-cceddc491573
NLJQ6T7MS45B3BP7QUC6QKTKTEHL6Y6GYRQPBJIUB65EF5N5XGTAC
ASSERT(num_stairs <= 3);
// If there are no stairs, it's either a branch entrance or exit.
// If we somehow have ended up in a catastrophic "no stairs" state,
// the level will not be validated, so we do not need to catch it here.
if (num_stairs == 0)
continue;
// At this point, up_stairs and down_stairs contain no more than
// three stairs. Ensure that they are unique.
for (int s = 0; s < (num_stairs == 3 ? 4 : 1); s++)
// Add extra stairs to get to exactly three.
for (int s = num_stairs; s < 3; s++)
{
coord_def gc;
do
{
gc.x = random2(GXM);
gc.y = random2(GYM);
}
while (grd(gc) != DNGN_FLOOR);
// base gets fixed up to be the right stone stair below...
grd(gc) = base;
stair_list[num_stairs++] = gc;
}
ASSERT(num_stairs == 3);
// Ensure uniqueness of three stairs.
for (int s = 0; s < 4; s++)