From df31ea9fdcfedf252e62f6bf0c5cff53df4b93d0 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 13 Jan 2008 20:34:46 +0000 Subject: Mixed commit of small additions/changes. FR 1870139: output "Tele" among enchantment abbrevs when "about to teleport" FR 1834016: print item slots along with rotting message (I added an option for this as I personally don't need this.) Gods: * Add ^ line for Zin's mutation protection. * Modify protection from harm adjectives in ^ screen to make difference between Ely and Zin/TSO more obvious. Tiles: Bug 1870238: Show mimics to be "autopickuable" (green frame). * Smarter handling of L-click actions in inventory. * code clean-up git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3269 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/item_use.cc') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index e5b12df2ef..4a7237c0f2 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4415,11 +4415,14 @@ void tile_use_item(int idx, InvAction act) // Equipped? bool equipped = false; + bool equipped_weapon = false; for (unsigned int i=0; i< NUM_EQUIP;i++) { if (you.equip[i] == idx) { equipped = true; + if (i == EQ_WEAPON) + equipped_weapon = true; break; } } @@ -4428,7 +4431,11 @@ void tile_use_item(int idx, InvAction act) // Special case for folks who are wielding something // that they shouldn't be wielding. - if (you.equip[EQ_WEAPON] == idx) + // Note that this is only a problem for equipables + // (otherwise it would only waste a turn) + if (you.equip[EQ_WEAPON] == idx + && (you.inv[idx].base_type == OBJ_ARMOUR + || you.inv[idx].base_type == OBJ_JEWELLERY)) { if (!check_warning_inscriptions(you.inv[idx], OPER_WIELD)) return; @@ -4437,6 +4444,7 @@ void tile_use_item(int idx, InvAction act) return; } + // Use it switch (you.inv[idx].base_type) { @@ -4472,7 +4480,7 @@ void tile_use_item(int idx, InvAction act) return; case OBJ_ARMOUR: - if (equipped) + if (equipped && !equipped_weapon) { if (!check_warning_inscriptions(you.inv[idx], OPER_TAKEOFF)) return; @@ -4493,8 +4501,12 @@ void tile_use_item(int idx, InvAction act) return; case OBJ_CORPSES: - if (you.species != SP_VAMPIRE) + if (you.species != SP_VAMPIRE + || you.inv[idx].sub_type == CORPSE_SKELETON + || you.inv[idx].special < 100) + { break; + } // intentional fall-through for Vampires case OBJ_FOOD: if (!check_warning_inscriptions(you.inv[idx], OPER_EAT)) @@ -4520,7 +4532,7 @@ void tile_use_item(int idx, InvAction act) return; case OBJ_JEWELLERY: - if (equipped) + if (equipped && !equipped_weapon) { if (!check_warning_inscriptions(you.inv[idx], OPER_REMOVE)) return; -- cgit v1.2.3-54-g00ecf