summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 11:22:35 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 11:22:35 +0000
commit92a5149b413abe69641720581624b5f867e663e5 (patch)
treed84e98dc32f8c68121ee4d4085f035008a4f04f0 /crawl-ref/source/view.cc
parentf910f85b74d9dae832f8d3422f51d87565ea3a08 (diff)
downloadcrawl-ref-92a5149b413abe69641720581624b5f867e663e5.tar.gz
crawl-ref-92a5149b413abe69641720581624b5f867e663e5.zip
Make patrolling monster movement more natural: don't always return to
the patrol centre, make it more likely to return to the patrol area if the monster left it somehow but is still nearby, and make friendly monsters move around the player on their way to their target. Also, highlight wizard commands in the wizard help. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5252 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 6daeea3893..019ea1605f 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2438,7 +2438,7 @@ bool find_ray( int sourcex, int sourcey, int targetx, int targety,
// Count the number of matching features between two points along
// a beam-like path; the path will pass through solid features.
-// By default, it excludes enpoints from the count.
+// By default, it excludes end points from the count.
int num_feats_between(int sourcex, int sourcey, int targetx, int targety,
dungeon_feature_type min_feat,
dungeon_feature_type max_feat,
@@ -3632,7 +3632,7 @@ bool see_grid( const coord_def &p )
return see_grid(env.show, you.pos(), p);
}
-// answers the question: "Would a grid be within character's line of sight,
+// Answers the question: "Would a grid be within character's line of sight,
// even if all translucent/clear walls were made opaque?"
bool see_grid_no_trans( const coord_def &p )
{
@@ -3645,6 +3645,25 @@ bool trans_wall_blocking( const coord_def &p )
return see_grid(p) && !see_grid_no_trans(p);
}
+// Usually calculates whether from one grid someone could see the other.
+// Depending on the viewer's habitat, 'allowed' can be set to DNGN_FLOOR,
+// DNGN_SHALLOW_WATER or DNGN_DEEP_WATER.
+// Yes, this ignores lava-loving monsters.
+bool grid_see_grid(int posx_1, int posy_1, int posx_2, int posy_2,
+ dungeon_feature_type allowed)
+{
+ if (distance(posx_1, posy_1, posx_2, posy_2) > LOS_RADIUS * LOS_RADIUS)
+ return (false);
+
+ dungeon_feature_type max_disallowed = DNGN_MAXOPAQUE;
+ if (allowed != DNGN_UNSEEN)
+ max_disallowed = static_cast<dungeon_feature_type>(allowed - 1);
+
+ // XXX: Ignoring clouds for now.
+ return (num_feats_between(posx_1, posy_1, posx_2, posy_2, DNGN_UNSEEN,
+ max_disallowed) == 0);
+}
+
static const unsigned dchar_table[ NUM_CSET ][ NUM_DCHAR_TYPES ] =
{
// CSET_ASCII