From 00e504625f9a75bb2fe9ce66b06d055c559b66b4 Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Sun, 17 Mar 2013 11:15:41 -0500 Subject: [PATCH] Prevent monsters with no path from following us down stairs. Fix contributed by Uronym. --- monmove.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monmove.cpp b/monmove.cpp index 0db99160accbe..36a2a71159a8d 100644 --- a/monmove.cpp +++ b/monmove.cpp @@ -766,6 +766,10 @@ bool monster::will_reach(game *g, int x, int y) if (has_flag(MF_IMMOBILE) && (posx != x || posy != y)) return false; + std::vector path = g->m.route(posx, posy, x, y, has_flag(MF_BASHES)); + if (path.size() == 0) + return false; + if (has_flag(MF_SMELLS) && g->scent(posx, posy) > 0 && g->scent(x, y) > g->scent(posx, posy)) return true;