summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e695b8974b..9adc4b1123 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2542,7 +2542,6 @@ static void _handle_behaviour(monsters *mon)
bool isScared = mon->has_ench(ENCH_FEAR);
bool isMobile = !mons_is_stationary(mon);
bool isPacified = mons_is_pacified(mon);
- bool travelling = mon->is_travelling();
bool patrolling = mon->is_patrolling();
static std::vector<level_exit> e;
static int e_index = -1;
@@ -2715,7 +2714,7 @@ static void _handle_behaviour(monsters *mon)
// Foe gone out of LOS?
if (!proxFoe)
{
- if (mon->foe == MHITYOU && travelling
+ if (mon->foe == MHITYOU && mon->is_travelling()
&& mon->travel_target == MTRAV_PLAYER)
{
// We've got a target, so we'll continue on our way.
@@ -2876,7 +2875,7 @@ static void _handle_behaviour(monsters *mon)
if (mon->travel_target != MTRAV_PATROL
&& mon->travel_target != MTRAV_NONE)
{
- if (travelling)
+ if (mon->is_travelling())
mon->travel_path.clear();
mon->travel_target = MTRAV_NONE;
}
@@ -2889,7 +2888,8 @@ static void _handle_behaviour(monsters *mon)
mon->name(DESC_PLAIN).c_str());
#endif
// If we're already on our way, do nothing.
- if (travelling && mon->travel_target == MTRAV_PLAYER)
+ if (mon->is_travelling()
+ && mon->travel_target == MTRAV_PLAYER)
{
int len = mon->travel_path.size();
coord_def targ = mon->travel_path[len - 1];
@@ -3127,7 +3127,7 @@ static void _handle_behaviour(monsters *mon)
|| mons_is_batty(mon) || !isPacified && one_chance_in(20))
{
bool need_target = true;
- if (travelling)
+ if (mon->is_travelling())
{
#ifdef DEBUG_PATHFIND
mprf("Monster %s reached target (%d, %d)",
@@ -3183,7 +3183,8 @@ static void _handle_behaviour(monsters *mon)
// is rather small.
int erase = -1; // Erase how many waypoints?
- for (int i = mon->travel_path.size() - 1; i >= 0; --i)
+ int size = mon->travel_path.size();
+ for (int i = size - 1; i >= 0; --i)
{
if (grid_see_grid(mon->x, mon->y,
mon->travel_path[i].x,
@@ -3355,7 +3356,7 @@ static void _handle_behaviour(monsters *mon)
|| isPacified && one_chance_in(isSmart ? 40 : 120))
{
new_foe = MHITNOT;
- if (travelling && mon->travel_target != MTRAV_PATROL
+ if (mon->is_travelling() && mon->travel_target != MTRAV_PATROL
|| isPacified)
{
#ifdef DEBUG_PATHFIND