From f79c9dacc90e9a7880f73abe03565e6d797e20a9 Mon Sep 17 00:00:00 2001 From: haranp Date: Wed, 4 Jul 2007 11:54:17 +0000 Subject: Implemented Blade card. Damnation will no longer work in Abyss/Pan/Lab. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1747 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 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 a5593022d4..f6ee93ef8f 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -747,15 +747,12 @@ bool do_wear_armour( int item, bool quiet ) return (false); } - for (int loopy = EQ_CLOAK; loopy <= EQ_BODY_ARMOUR; loopy++) + if ( wearing_slot(item) ) { - if (item == you.equip[loopy]) - { - if (!quiet) - mpr("You are already wearing that!"); + if (!quiet) + mpr("You are already wearing that!"); - return (false); - } + return (false); } // if you're wielding something, @@ -1106,13 +1103,10 @@ void throw_anything(void) } else { - for (int loopy = EQ_CLOAK; loopy <= EQ_AMULET; loopy++) + if ( wearing_slot(throw_slot) ) { - if (throw_slot == you.equip[loopy]) - { - mpr("You are wearing that object!"); - return; - } + mpr("You are wearing that object!"); + return; } } @@ -3730,3 +3724,11 @@ void use_randart(const item_def &item) xom_is_stimulated(256); } } + +bool wearing_slot(int inv_slot) +{ + for (int i = EQ_CLOAK; i <= EQ_AMULET; ++i) + if ( inv_slot == you.equip[i] ) + return true; + return false; +} -- cgit v1.2.3-54-g00ecf