summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/traps.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-06-01 10:43:27 -0400
committerNeil Moore <neil@s-z.org>2014-06-01 10:43:31 -0400
commit8da35e98ad92bab1c613fd6c31884472d50b5172 (patch)
tree5457ba3fb966ad0d4ee2e6ba8e1cce2b8759048d /crawl-ref/source/traps.cc
parent8274541554a1e2010862df73373eb56355ce0cc6 (diff)
downloadcrawl-ref-8da35e98ad92bab1c613fd6c31884472d50b5172.tar.gz
crawl-ref-8da35e98ad92bab1c613fd6c31884472d50b5172.zip
Avoid a crash when escaping nets.
Update the net in the stash tracker when either you or a monster escapes the net, so a later ctrl-x (etc.) doesn't try and fail to find the held actor.
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r--crawl-ref/source/traps.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 68118a1f42..133aaa6f2d 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -1412,6 +1412,7 @@ void free_stationary_net(int item_index)
item_def &item = mitm[item_index];
if (item.base_type == OBJ_MISSILES && item.sub_type == MI_THROWING_NET)
{
+ const coord_def pos = item.pos;
// Probabilistically mulch net based on damage done, otherwise
// reset damage counter (ie: item.plus).
if (x_chance_in_y(-item.plus, 9))
@@ -1421,6 +1422,10 @@ void free_stationary_net(int item_index)
item.plus = 0;
item.plus2 = 0;
}
+
+ // Make sure we don't leave a bad trapping net in the stash
+ // FIXME: may leak info if a monster escapes an out-of-sight net.
+ StashTrack.update_stash(pos);
}
}