diff options
author | Neil Moore <neil@s-z.org> | 2013-12-04 17:32:18 -0500 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-12-04 17:36:55 -0500 |
commit | f0ae6098ef3016ddda80d4e1020a03e67e19e39a (patch) | |
tree | 0c6e6a6cecf927b46da49845781cbe1e43637a34 /crawl-ref/source/mon-transit.cc | |
parent | 0a0213c784f42c0ffd7a47b8b6b07051a352b062 (diff) | |
download | crawl-ref-f0ae6098ef3016ddda80d4e1020a03e67e19e39a.tar.gz crawl-ref-f0ae6098ef3016ddda80d4e1020a03e67e19e39a.zip |
Remove monsters from the transit list when dactions kill them.
This could happen with when DACT_END_SPIRIT_HOWL resets the remaining
spirit wolves that are not in LOS. See for example !lg Apol crash 1
There still may be other situations that put or leave dead monsters in
the transit list: see #7146.
Diffstat (limited to 'crawl-ref/source/mon-transit.cc')
-rw-r--r-- | crawl-ref/source/mon-transit.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-transit.cc b/crawl-ref/source/mon-transit.cc index d32b1ffab3..0555bedc70 100644 --- a/crawl-ref/source/mon-transit.cc +++ b/crawl-ref/source/mon-transit.cc @@ -256,6 +256,12 @@ void apply_daction_to_transit(daction_type act) monster* mon = &j->mons; if (mons_matches_daction(mon, act)) apply_daction_to_mons(mon, act, false, true); + + // If that killed the monster, remove it from transit. + // Removing this monster invalidates the iterator that + // points to it, so decrement the iterator first. + if (!mon->alive()) + m->erase(j--); } } } |