summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/traps.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/traps.cc')
-rw-r--r--crawl-ref/source/traps.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 0e0bd2ec4f..764f3b429b 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -1129,6 +1129,10 @@ void trap_def::shoot_ammo(actor& act, bool was_known)
}
else
{
+ // Record position now, in case it's a monster and dies (thus
+ // resetting its position) before the ammo can be droped.
+ const coord_def apos = act.pos();
+
item_def shot = this->generate_trap_item();
bool poison = (this->type == TRAP_NEEDLE);
int damage_taken =
@@ -1233,7 +1237,7 @@ void trap_def::shoot_ammo(actor& act, bool was_known)
// Drop the item (sometimes.)
if (coinflip())
- copy_item_to_grid(shot, act.pos());
+ copy_item_to_grid(shot, apos);
this->ammo_qty--;
}