diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-27 20:15:24 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-27 20:15:24 +0000 |
commit | 66c149dbd38eca4599dd015b9271d2e1bcf46472 (patch) | |
tree | 160ae3e19f11630e8d0333b5b43098ef5a72773b /crawl-ref/source/spells3.cc | |
parent | 70ce5c5c0ce725bdb808bc5d5e7b216a7707e911 (diff) | |
download | crawl-ref-66c149dbd38eca4599dd015b9271d2e1bcf46472.tar.gz crawl-ref-66c149dbd38eca4599dd015b9271d2e1bcf46472.zip |
Modify num_feats_between to return early if a feature has been
encountered and we're only interested in whether the path is clear or
not. Also, more whitespace/comment changes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5298 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r-- | crawl-ref/source/spells3.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index af6c347b07..08b6d3e9bf 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -753,12 +753,11 @@ bool entomb(int powc) }; for (int srx = you.x_pos - 1; srx < you.x_pos + 2; srx++) - { for (int sry = you.y_pos - 1; sry < you.y_pos + 2; sry++) { - // tile already occupied by monster or yourself {dlb}: + // Tile already occupied by monster or yourself {dlb}: if (mgrd[srx][sry] != NON_MONSTER - || (srx == you.x_pos && sry == you.y_pos)) + || srx == you.x_pos && sry == you.y_pos) { continue; } @@ -827,11 +826,10 @@ bool entomb(int powc) } } - // finally, place the wall {dlb}: + // Finally, place the wall {dlb}: grd[srx][sry] = DNGN_ROCK_WALL; number_built++; - } // end "for srx,sry" - } + } if (number_built > 0) { @@ -843,7 +841,7 @@ bool entomb(int powc) const coord_def pos = mon->pos(); int walls = num_feats_between(you.x_pos, you.y_pos, pos.x, pos.y, DNGN_UNSEEN, - DNGN_MAXWALL); + DNGN_MAXWALL, true, true); if (walls > 0) { |