summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/acr.cc1
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/travel.cc30
-rw-r--r--crawl-ref/source/travel.h7
4 files changed, 39 insertions, 1 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 0fdc0f8a0c..5d825b3094 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3937,6 +3937,7 @@ static bool _initialise(void)
// Set vision radius to player's current vision.
setLOSRadius(you.current_vision);
+ init_exclusion_los();
if (newc) // start a new game
{
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 822d625fcd..582270242a 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2097,6 +2097,8 @@ bool vitrify_area(int radius)
something_happened = true;
}
}
+ if (something_happened)
+ init_exclusion_los();
return (something_happened);
}
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index f562bcadfe..66b2ebe0f3 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -274,12 +274,33 @@ bool is_traversable(dungeon_feature_type grid)
return (traversable_terrain[grid] == TRAVERSABLE);
}
+void travel_exclude::set_exclude_show()
+{
+ losight(show, grd, pos);
+}
+
+void init_exclusion_los()
+{
+ for (unsigned int i = 0; i < curr_excludes.size(); i++)
+ curr_excludes[i].set_exclude_show();
+}
+
+void update_exclusion_los(coord_def &p)
+{
+ for (unsigned int i = 0; i < curr_excludes.size(); i++)
+ if ((curr_excludes[i].pos - p).abs() <= LOS_RADIUS)
+ curr_excludes[i].set_exclude_show();
+}
+
static bool _is_excluded(const coord_def &p,
const std::vector<travel_exclude> &exc)
{
for (int i = 0, count = exc.size(); i < count; ++i)
- if ((exc[i].pos - p).abs() < exc[i].radius_sq())
+ if ((exc[i].pos - p).abs() < exc[i].radius_sq()
+ && see_grid(exc[i].show, exc[i].pos, p))
+ {
return (true);
+ }
return (false);
}
@@ -3107,6 +3128,13 @@ std::string stair_info::describe() const
void LevelInfo::set_level_excludes()
{
curr_excludes = excludes;
+/*
+ for (unsigned int i = 0; i < curr_excludes.size(); i++)
+ {
+ curr_excludes[i] = travel_exclude(curr_excludes[i].pos,
+ curr_excludes[i].radius);
+ }
+*/
}
bool LevelInfo::empty() const
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 320749506b..77368c23be 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -435,14 +435,21 @@ public:
bool can_travel() const { return (type == PHYSICAL); }
};
+void init_exclusion_los();
+void update_exclusion_los(coord_def &p);
+
struct travel_exclude
{
coord_def pos;
int radius;
+ env_show_grid show;
+
+ void set_exclude_show();
travel_exclude(const coord_def &p, int r = LOS_RADIUS)
: pos(p), radius(r)
{
+ set_exclude_show();
}
int radius_sq() const