summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 06:34:25 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 06:34:25 +0000
commit2af58b0346183d18125bfa5867be4339ce055ffe (patch)
tree937b1e45d0d7e8faa72b859c09f7e68b8ea8d273 /crawl-ref/source/spells2.cc
parent3fe0cf688e2dad0503dbb31dd43cfe3bd1fa6536 (diff)
downloadcrawl-ref-2af58b0346183d18125bfa5867be4339ce055ffe.tar.gz
crawl-ref-2af58b0346183d18125bfa5867be4339ce055ffe.zip
Make the position of monster held items (-2, -2) rather than (0, 0), so that
any valid item in mitm[] which is still at (0, 0) by the time debug_item_scan() is called must be buggy. Also set the link fields of monster held items to NON_ITEM + 1 + monster_index, so that it's easy to tell which monster is holding any given item; this is used in debug_mons_scan() and monsters::pickup() to do some sanity checking of monster inventory. I've tried to thoroughly test this, but there might still be some bugs left. Breaks savefile compatibility (or, rather, will lead to endless error messages if you use an old save file). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8322 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index b76445aad2..48ff558ec8 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1718,6 +1718,11 @@ bool cast_tukimas_dance(int pow, god_type god,
if (i == NON_ITEM)
success = false;
+ else
+ // Copy item now so that mitm[i] is occupied and doesn't get picked
+ // by get_item_slot() when giving the dancing weapon it's item
+ // during create_monster().
+ mitm[i] = you.inv[wpn];
int monster;
@@ -1736,7 +1741,10 @@ bool cast_tukimas_dance(int pow, god_type god,
0, god));
if (monster == -1)
+ {
+ mitm[i].clear();
success = false;
+ }
}
if (!success)
@@ -1760,8 +1768,8 @@ bool cast_tukimas_dance(int pow, god_type god,
// Copy the unwielded item.
mitm[i] = you.inv[wpn];
mitm[i].quantity = 1;
- mitm[i].pos.reset();
- mitm[i].link = NON_ITEM;
+ mitm[i].pos.set(-2, -2);
+ mitm[i].link = NON_ITEM + 1 + monster;
// Mark the weapon as thrown, so that we'll autograb it when the
// tango's done.