summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-08 22:52:03 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-08 22:52:03 +0200
commitac38661a15a4ac915e6b5b59dc4aabe5ae5da05c (patch)
treef3e4ebf119a5693325da72b3f8ce66c47818186a /crawl-ref/source
parentd87a308f449bb959db24495e2a1dc307924bc8ae (diff)
downloadcrawl-ref-ac38661a15a4ac915e6b5b59dc4aabe5ae5da05c.tar.gz
crawl-ref-ac38661a15a4ac915e6b5b59dc4aabe5ae5da05c.zip
Move can_go_straight from los.cc to monstuff.cc.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/los.cc19
-rw-r--r--crawl-ref/source/los.h2
-rw-r--r--crawl-ref/source/monstuff.cc19
-rw-r--r--crawl-ref/source/monstuff.h4
4 files changed, 23 insertions, 21 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index f585b65d58..14dc1e3f6c 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -692,25 +692,6 @@ bool cell_see_cell(const coord_def& p1, const coord_def& p2)
return see_grid(show, p1, p2);
}
-// Checks whether there is a straight path from p1 to p2 that passes
-// through features >= allowed.
-// If it exists, such a path may be missed; on the other hand, it
-// is not guaranteed that p2 is visible from p1 according to LOS rules.
-// Not symmetric.
-bool can_go_straight(const coord_def& p1, const coord_def& p2,
- dungeon_feature_type allowed)
-{
- if (distance(p1, p2) > _los_radius_squared)
- return (false);
-
- dungeon_feature_type max_disallowed = DNGN_MAXOPAQUE;
- if (allowed != DNGN_UNSEEN)
- max_disallowed = static_cast<dungeon_feature_type>(allowed - 1);
-
- return (!num_feats_between(p1, p2, DNGN_UNSEEN, max_disallowed,
- true, true));
-}
-
// The rule behind LOS is:
// Two cells can see each other if there is any line from some point
// of the first to some point of the second ("generous" LOS.)
diff --git a/crawl-ref/source/los.h b/crawl-ref/source/los.h
index 379983c095..1c258d34a8 100644
--- a/crawl-ref/source/los.h
+++ b/crawl-ref/source/los.h
@@ -28,8 +28,6 @@ int num_feats_between(const coord_def& source, const coord_def& target,
bool exclude_endpoints = true,
bool just_check = false);
bool cell_see_cell(const coord_def& p1, const coord_def& p2);
-bool can_go_straight(const coord_def& p1, const coord_def& p2,
- dungeon_feature_type allowed);
void clear_rays_on_exit();
void losight(env_show_grid& sh, const los_param& dat);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 54ae2b7805..de0534aeb7 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3497,6 +3497,25 @@ static bool _target_is_unreachable(monsters *mon)
|| mon->travel_target == MTRAV_KNOWN_UNREACHABLE);
}
+// Checks whether there is a straight path from p1 to p2 that passes
+// through features >= allowed.
+// If it exists, such a path may be missed; on the other hand, it
+// is not guaranteed that p2 is visible from p1 according to LOS rules.
+// Not symmetric.
+bool can_go_straight(const coord_def& p1, const coord_def& p2,
+ dungeon_feature_type allowed)
+{
+ if (distance(p1, p2) > get_los_radius_squared())
+ return (false);
+
+ dungeon_feature_type max_disallowed = DNGN_MAXOPAQUE;
+ if (allowed != DNGN_UNSEEN)
+ max_disallowed = static_cast<dungeon_feature_type>(allowed - 1);
+
+ return (!num_feats_between(p1, p2, DNGN_UNSEEN, max_disallowed,
+ true, true));
+}
+
// The monster is trying to get to the player (MHITYOU).
// Check whether there's an unobstructed path to the player (in sight!),
// either by using an existing travel_path or calculating a new one.
diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h
index 01e9301395..22b7c3bbdd 100644
--- a/crawl-ref/source/monstuff.h
+++ b/crawl-ref/source/monstuff.h
@@ -201,4 +201,8 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
cloud_type *cl_type = NULL, bool placement = false);
void mons_relocated(monsters *mons);
+
+bool can_go_straight(const coord_def& p1, const coord_def& p2,
+ dungeon_feature_type allowed);
+
#endif