From 0a5123f9f193aff98a112bdc915ef94aa819cc5d Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sat, 27 Oct 2007 10:10:27 +0000 Subject: Fixed !R inscription not confirming remove when only one item is worn (jarpiain). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2618 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/invent.cc | 30 ++++++++++++++++++++++++++++-- crawl-ref/source/item_use.cc | 6 ++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index bc48e94588..f8af3d11e1 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -1069,15 +1069,41 @@ static bool check_old_item_warning( const item_def& item, return yesno(prompt.c_str(), false, 'n'); } +static std::string operation_verb(operation_types oper) +{ + switch (oper) + { + case OPER_WIELD: return "wield"; + case OPER_QUAFF: return "quaff"; + case OPER_DROP: return "drop"; + case OPER_EAT: return "eat"; + case OPER_TAKEOFF: return "take off"; + case OPER_WEAR: return "wear"; + case OPER_PUTON: return "put on"; + case OPER_REMOVE: return "remove"; + case OPER_READ: return "read"; + case OPER_MEMORISE: return "memorise from"; + case OPER_ZAP: return "zap"; + case OPER_THROW: return "throw"; + case OPER_EXAMINE: return "examine"; + case OPER_FIRE: return "fire"; + case OPER_PRAY: return "sacrifice"; + case OPER_EVOKE: return "evoke"; + case OPER_ANY: + default: + return "choose"; + } +} + /* return true if user OK'd it (or no warning), false otherwise */ bool check_warning_inscriptions( const item_def& item, operation_types oper ) { if (is_valid_item( item ) && has_warning_inscription(item, oper) ) { - std::string prompt = "Really choose "; + std::string prompt = "Really " + operation_verb(oper) + " "; prompt += item.name(DESC_INVENTORY); - prompt += '?'; + prompt += "? "; return (yesno(prompt.c_str(), false, 'n') && check_old_item_warning(item, oper)); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index d614bc768c..8113033a6b 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2836,6 +2836,12 @@ bool remove_ring(int slot, bool announce) return (false); } } + else if (!check_warning_inscriptions(you.inv[you.equip[hand_used]], + OPER_REMOVE)) + { + canned_msg(MSG_OK); + return (false); + } if (you.equip[EQ_GLOVES] != -1 && item_cursed( you.inv[you.equip[EQ_GLOVES]] ) -- cgit v1.2.3-54-g00ecf