summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 11:07:40 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-05 11:12:50 -0600
commitcf225c256f67b33f96a04c243f7c88ba23168664 (patch)
treef815dfbb1562b957f700785909c882ebf870a0a6 /crawl-ref/source/effects.cc
parent48f785a271089f4f85bdfb5624b56b433e0ebd13 (diff)
downloadcrawl-ref-cf225c256f67b33f96a04c243f7c88ba23168664.tar.gz
crawl-ref-cf225c256f67b33f96a04c243f7c88ba23168664.zip
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.
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 26289f2616..be30e40cc5 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -3945,10 +3945,7 @@ void handle_time(long time_delta)
// Spread jellies around the level.
coord_def newpos;
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
|| monster_at(newpos)