diff options
author | Pekka Lampila <pekka.lampila@iki.fi> | 2013-05-03 19:22:11 +0300 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-09-01 15:19:10 -0400 |
commit | 4e06f6f60faef46939f77dc610dad1874e619572 (patch) | |
tree | 37ec54dfac32f70f166338e4bc803166295dc12e /crawl-ref/source/travel.cc | |
parent | 7a74111b2095dea22efb10ca874e79520ac25006 (diff) | |
download | crawl-ref-4e06f6f60faef46939f77dc610dad1874e619572.tar.gz crawl-ref-4e06f6f60faef46939f77dc610dad1874e619572.zip |
Don't autotravel through monsters caught in nets
Fixes an infinite loop, caused by endlessly trying to swap with an
allied monster caught in a net/web.
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r-- | crawl-ref/source/travel.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index b3715e9e95..f9d43850d9 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -424,12 +424,19 @@ static bool _is_travelsafe_square(const coord_def& c, bool ignore_hostile, // Also make note of what's displayed on the level map for // plant/fungus checks. const map_cell& levelmap_cell = env.map_knowledge(c); + const monster_info *minfo = levelmap_cell.monsterinfo(); + + // Can't swap with monsters caught in nets + if (minfo && minfo->attitude >= ATT_STRICT_NEUTRAL + && (minfo->is(MB_CAUGHT) || minfo->is(MB_WEBBED)) && !try_fallback) + { + return false; + } // Travel will not voluntarily cross squares blocked by immobile // monsters. if (!ignore_danger && !ignore_hostile) { - const monster_info *minfo = levelmap_cell.monsterinfo(); if (minfo && _monster_blocks_travel(minfo)) return false; } |