diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-30 10:53:06 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-30 10:53:06 +0000 |
commit | 262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f (patch) | |
tree | 681a9cbb6c22669c6e8b7ab749228a3cd691a903 /crawl-ref/source/stuff.cc | |
parent | 51d8f1fc9cc8ed4280b9c53b135ccb0521e84889 (diff) | |
download | crawl-ref-262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f.tar.gz crawl-ref-262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f.zip |
Massive overhaul to move towards coord_def().
This might have introduced some bugs: I now get intermittent crashes
on startup (this might have to do with the changes to special_room.)
Sorry about that - committing before I need to do any more big conflict
resolutions. Fixes coming later.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6732 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r-- | crawl-ref/source/stuff.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index c9f00ece2d..ad112415f9 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -399,18 +399,11 @@ static int follower_tag_radius2() { // If only friendlies are adjacent, we set a max radius of 6, otherwise // only adjacent friendlies may follow. - coord_def p; - for (p.x = you.x_pos - 1; p.x <= you.x_pos + 1; ++p.x) - for (p.y = you.y_pos - 1; p.y <= you.y_pos + 1; ++p.y) - { - if (p == you.pos()) - continue; - if (const monsters *mon = monster_at(p)) - { - if (!mons_friendly(mon)) - return (2); - } - } + for ( adjacent_iterator ai; ai; ++ai ) + if (const monsters *mon = monster_at(*ai)) + if (!mons_friendly(mon)) + return (2); + return (6 * 6); } @@ -1285,8 +1278,8 @@ void random_in_bounds( int &x_pos, int &y_pos, int terr, && grd[x_pos][y_pos] == DNGN_SHALLOW_WATER) done = true; else if (empty - && mgrd[x_pos][y_pos] != NON_MONSTER - && (x_pos != you.x_pos || y_pos != you.y_pos)) + && mgrd[x_pos][y_pos] != NON_MONSTER + && (coord_def(x_pos,y_pos) != you.pos())) { done = true; } @@ -1633,7 +1626,7 @@ void zap_los_monsters() if (!map_bounds(gx, gy)) continue; - if (gx == you.x_pos && gy == you.y_pos) + if (gx == you.pos().x && gy == you.pos().y) continue; int imon = mgrd[gx][gy]; |