diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-05 14:06:26 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-05 14:06:26 +0000 |
commit | 376d7d8be0443ac004a1fe5d88f56325497d1921 (patch) | |
tree | d62c43ed0b1f20302776380fdd15eb53c7c65459 /crawl-ref/source/items.cc | |
parent | 55812ea322d83879cd9ed09d27f18ab2d0345def (diff) | |
download | crawl-ref-376d7d8be0443ac004a1fe5d88f56325497d1921.tar.gz crawl-ref-376d7d8be0443ac004a1fe5d88f56325497d1921.zip |
Slight cleanup of randart autoinscription.
Code cleanup with unrandarts and fixedarts. Bugfix for isomorphic-up-to-colour
unrandarts being confused when lost in the Abyss.
Trowel will not clobber critical features (stairs, portals, etc.)
Nemelex is unhappy about Trowel failing.
Breaks savefiles.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3003 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index c813175175..2399c68080 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -192,17 +192,18 @@ int cull_items(void) if (item_ok_to_clean(item) && random2(100) < 15) { - if (is_fixed_artefact( mitm[item] )) + const item_def& obj(mitm[item]); + if (is_fixed_artefact(obj)) { // 7. move uniques to abyss - set_unique_item_status( OBJ_WEAPONS, mitm[item].special, + set_unique_item_status( OBJ_WEAPONS, obj.special, UNIQ_LOST_IN_ABYSS ); } - else if (is_unrandom_artefact( mitm[item] )) + else if (is_unrandom_artefact(obj)) { // 9. unmark unrandart - int z = find_unrandart_index(item); - if (z >= 0) + const int z = find_unrandart_index(obj); + if (z != -1) set_unrandart_exist(z, false); } @@ -509,21 +510,25 @@ void destroy_item( int dest, bool never_created ) unlink_item( dest ); + item_def& item(mitm[dest]); + if (never_created) { - if (is_fixed_artefact(mitm[dest])) - set_unique_item_status( mitm[dest].base_type, mitm[dest].special, - UNIQ_NOT_EXISTS ); - else if (is_unrandom_artefact(mitm[dest])) + if (is_fixed_artefact(item)) + { + set_unique_item_status(item.base_type, item.special, + UNIQ_NOT_EXISTS); + } + else if (is_unrandom_artefact(item)) { - const int unrand = find_unrandart_index(dest); + const int unrand = find_unrandart_index(item); if (unrand != -1) set_unrandart_exist( unrand, false ); } } // paranoia, shouldn't be needed - mitm[dest].clear(); + item.clear(); } static void handle_gone_item(const item_def &item) |