diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 05:58:07 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 05:58:07 +0000 |
commit | ba85b544426d529b9b09bef6afaceb3691fbe276 (patch) | |
tree | 86e55c2df981bb3cb6b0ac489d16f6f6c359a597 /crawl-ref/source/stuff.cc | |
parent | ce025121d1e801ca7561f4b8d409361d14ef6855 (diff) | |
download | crawl-ref-ba85b544426d529b9b09bef6afaceb3691fbe276.tar.gz crawl-ref-ba85b544426d529b9b09bef6afaceb3691fbe276.zip |
During arena mode make random_in_bounds() return a point inside the view port.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8835 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r-- | crawl-ref/source/stuff.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index d724ca5730..ff4f4e64b1 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -1279,8 +1279,17 @@ bool map_bounds(int x, int y) coord_def random_in_bounds() { - return coord_def(random_range(MAPGEN_BORDER, GXM - MAPGEN_BORDER - 1), - random_range(MAPGEN_BORDER, GYM - MAPGEN_BORDER - 1)); + if (crawl_state.arena) + { + const coord_def &ul = crawl_view.glos1; // Upper left + const coord_def &lr = crawl_view.glos2; // Lower right + + return coord_def(random_range(ul.x, lr.x - 1), + random_range(ul.y, lr.y - 1)); + } + else + return coord_def(random_range(MAPGEN_BORDER, GXM - MAPGEN_BORDER - 1), + random_range(MAPGEN_BORDER, GYM - MAPGEN_BORDER - 1)); } // Returns a random location in (x_pos, y_pos)... the grid will be |