summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorDracoOmega <draco_omega@live.com>2014-02-25 04:55:23 -0330
committerDracoOmega <draco_omega@live.com>2014-02-25 05:22:09 -0330
commitfd33211bd3db09b14bf07fa225ad75c93a8a318f (patch)
treedd371c7f19640b20a5ff9b259351a5440899019e /crawl-ref/source/misc.cc
parentec04de39fa476951b75ba4d8f8b69b927954cfc1 (diff)
downloadcrawl-ref-fd33211bd3db09b14bf07fa225ad75c93a8a318f.tar.gz
crawl-ref-fd33211bd3db09b14bf07fa225ad75c93a8a318f.zip
Make monster pathfinding less player-centric
Most pathfinding checks assumed that the only thing a monster would be trying to path towards was the player, even though this was frequently untrue (either hostile monsters targeting player allies or friendly monsters trying to reach other monsters). A few bugs existed as a result of this: When monsters without ranged attacks would check the reachability of their foe, they would check the reachability of the player instead, regardless of what was shooting at them or whether the player was even involved in the battle. This meant that melee-only monsters would flee from ranged attacks in the arena (where the player is understandably never reachable) and also could show up occasionally in normal play - such as retreating from an oklob fort if the player is behind water. I expect there are a few other bugs related to similar assumptions, but moreover, allowing monsters to use proper pathfinding to non-player foes likely improves ally intelligence somewhat. As always with fiddly monster behavioral code, there is a non-trivial chance that some important side-effect has been overlooked, but initial testing looks good.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 550cedec55..298d95cfd5 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1414,7 +1414,7 @@ static bool _mons_has_path_to_player(const monster* mon, bool want_move = false)
// If the monster is awake and knows a path towards the player
// (even though the player cannot know this) treat it as unsafe.
- if (mon->travel_target == MTRAV_PLAYER)
+ if (mon->travel_target == MTRAV_FOE)
return true;
if (mon->travel_target == MTRAV_KNOWN_UNREACHABLE)