From cf225c256f67b33f96a04c243f7c88ba23168664 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 5 Nov 2009 11:07:40 -0600 Subject: Clean up random coordinate usage a bit. Specifically, use random_in_bounds() in a few places instead of random ranges involving X_BOUND and Y_BOUND values. The former won't return any coordinates in the dungeon's map border (which acts as a wall), but the latter will, and all the changed places are looking for empty dungeon squares, so this should make these operations more efficient. --- crawl-ref/source/spells3.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crawl-ref/source/spells3.cc') diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 8451322adb..d6293b7063 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1585,10 +1585,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) } do - { - newpos.set( random_range(X_BOUND_1 + 1, X_BOUND_2 - 1), - random_range(Y_BOUND_1 + 1, Y_BOUND_2 - 1) ); - } + newpos = random_in_bounds(); while (grd(newpos) != DNGN_FLOOR && grd(newpos) != DNGN_SHALLOW_WATER && (you.species != SP_MERFOLK -- cgit v1.2.3-54-g00ecf