I have no idea if this works or not, because I’m not sure how to test it, but, if you add this code at line ~770 in function monster::will_reach of monmove.cpp, does it fix Issue #36, where monsters will warp with you down stairs, even if there’s no valid path to the stairs?
std::vector<point> path = g->m.route(posx, posy, x, y, has_flag(MF_BASHES));
if (path.size() == 0)
return false;
I couldn’t find any documentation for the route function, but from what I could tell, if size == 0, it means there is no valid path. If I understand this right, it will make monster::will_reach return false if there’s no valid path.