diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-05 14:17:12 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-09-05 14:17:12 +0000 |
commit | 88fd21a557af9d87d660e896023b7e8788ea915f (patch) | |
tree | fd6a8cd7d2bbb8a4058fb8399de3a4d9c2582014 /crawl-ref/source/invent.cc | |
parent | 8f913bcaf69f680eabc6bbdd2dff2afb311b4ffb (diff) | |
download | crawl-ref-88fd21a557af9d87d660e896023b7e8788ea915f.tar.gz crawl-ref-88fd21a557af9d87d660e896023b7e8788ea915f.zip |
Fixing more bugs.
1788159: Mummy priests don't get potions either.
1787377: Lugonu's Banish doesn't work on self
1786808: More feedback for travelling.
1784235: Randomized staff descriptions.
1774996: /random effect autoIDs for fireball
1768803: Extended inscription warning use.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2057 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index c1cc52102c..e757ecee26 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1004,6 +1004,61 @@ bool has_warning_inscription(const item_def& item, return false; } +// checks if current item (to be removed) has a warning inscription +// and prompts the user for confirmation +static bool check_old_item_warning( const item_def& item, + operation_types oper ) +{ + item_def old_item; + std::string prompt = ""; + if (oper == OPER_WIELD) // can we safely unwield old item? + { + if (you.equip[EQ_WEAPON] == -1) + return (true); + + old_item = you.inv[you.equip[EQ_WEAPON]]; + if (!has_warning_inscription(old_item, OPER_WIELD)) + return (true); + + prompt += "Really unwield "; + } + else if (oper == OPER_WEAR) // can we safely take off old item? + { + equipment_type eq_slot = get_armour_slot(item); + if (you.equip[eq_slot] == -1) + return (true); + + old_item = you.inv[you.equip[eq_slot]]; + if (!has_warning_inscription(old_item, OPER_TAKEOFF)) + return (true); + + prompt += "Really take off "; + } + else if (oper == OPER_PUTON) // can we safely remove old item? + { + if (jewellery_is_amulet(item)) + { + if (you.equip[EQ_AMULET] == -1) + return (true); + + old_item = you.inv[you.equip[EQ_AMULET]]; + if (!has_warning_inscription(old_item, OPER_TAKEOFF)) + return (true); + + prompt += "Really remove "; + } + else // rings handled in prompt_ring_to_remove + return (true); + } + else // anything else doesn't have a counterpart + return (true); + + // now ask + prompt += old_item.name(DESC_INVENTORY); + prompt += '?'; + return yesno(prompt.c_str(), false, 'n'); +} + /* return true if user OK'd it (or no warning), false otherwise */ bool check_warning_inscriptions( const item_def& item, operation_types oper ) @@ -1013,10 +1068,11 @@ bool check_warning_inscriptions( const item_def& item, std::string prompt = "Really choose "; prompt += item.name(DESC_INVENTORY); prompt += '?'; - return yesno(prompt.c_str(), false, 'n'); + return (yesno(prompt.c_str(), false, 'n') + && check_old_item_warning(item, oper)); } else - return true; + return (check_old_item_warning(item, oper)); } // This function prompts the user for an item, handles the '?' and '*' |