diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-08 06:34:25 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-08 06:34:25 +0000 |
commit | 2af58b0346183d18125bfa5867be4339ce055ffe (patch) | |
tree | 937b1e45d0d7e8faa72b859c09f7e68b8ea8d273 /crawl-ref/source/dungeon.cc | |
parent | 3fe0cf688e2dad0503dbb31dd43cfe3bd1fa6536 (diff) | |
download | crawl-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/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 5a587c2a45..20df74f463 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -1087,8 +1087,11 @@ static void _fixup_misplaced_items() for (int i = 0; i < MAX_ITEMS; i++) { item_def& item(mitm[i]); - if (!is_valid_item(item) || (item.pos.x == 0)) + if (!is_valid_item(item) || (item.pos.x == 0) + || held_by_monster(item)) + { continue; + } if (in_bounds(item.pos)) { @@ -5598,7 +5601,10 @@ void place_spec_shop( int level_number, if (orb != NON_ITEM && _need_varied_selection(env.shop[i].type)) { if (!one_chance_in(stocked[mitm[orb].sub_type] + 1)) + { + mitm[orb].clear(); orb = NON_ITEM; // try again + } } if (orb != NON_ITEM @@ -5612,10 +5618,7 @@ void place_spec_shop( int level_number, // Reset object and try again. if (orb != NON_ITEM) - { - mitm[orb].base_type = OBJ_UNASSIGNED; - mitm[orb].quantity = 0; - } + mitm[orb].clear(); } if (orb == NON_ITEM) |