From 2af58b0346183d18125bfa5867be4339ce055ffe Mon Sep 17 00:00:00 2001 From: zelgadis Date: Thu, 8 Jan 2009 06:34:25 +0000 Subject: 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 --- crawl-ref/source/tags.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/tags.cc') diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index e5ff017648..fde326b19b 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -1767,11 +1767,11 @@ void marshallItem(writer &th, const item_def &item) marshallShort(th, item.pos.y); marshallLong(th, item.flags); - marshallShort(th, item.link); // unused - if (item.pos.x == -1 && item.pos.y == -1) - marshallShort(th, -1); // unused - else + marshallShort(th, item.link); + if (item.pos.x >= 0 && item.pos.y >= 0) marshallShort(th, igrd(item.pos)); // unused + else + marshallShort(th, -1); // unused marshallByte(th, item.slot); @@ -1794,8 +1794,8 @@ void unmarshallItem(reader &th, item_def &item) item.pos.x = unmarshallShort(th); item.pos.y = unmarshallShort(th); item.flags = (unsigned long) unmarshallLong(th); + item.link = unmarshallShort(th); - unmarshallShort(th); // mitm[].link -- unused unmarshallShort(th); // igrd[item.x][item.y] -- unused item.slot = unmarshallByte(th); -- cgit v1.2.3-54-g00ecf