diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-18 15:51:08 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-02-18 15:51:08 +0000 |
commit | a59025b069d3d08cfa7c5ccd21d3b0ae116da71c (patch) | |
tree | c15ea1bf8d4491edc73efef473413ddfc30a09ff /crawl-ref/source/item_use.cc | |
parent | e3c41fc21fc88f1e1edb67992a7cb0bbe68abe83 (diff) | |
download | crawl-ref-a59025b069d3d08cfa7c5ccd21d3b0ae116da71c.tar.gz crawl-ref-a59025b069d3d08cfa7c5ccd21d3b0ae116da71c.zip |
First batch of Paul's patches:
1896018: cycle ammo with '('
1895278: no (v)iewing of unreadable books
1895075: cancel Ely's abilities without cost
Fix 1894920: fix overly long dungeon overview
Also fix 1884145: weapon swap ignoring {!w}
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3441 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 34993cbd01..e0cbce7b0e 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -190,12 +190,6 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) if (!can_wield(NULL, true)) return (false); - if (you.duration[DUR_SURE_BLADE]) - { - mpr("The bond with your blade fades away."); - you.duration[DUR_SURE_BLADE] = 0; - } - int item_slot = 0; // default is 'a' if (auto_wield) @@ -215,9 +209,6 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) || (you.inv[item_slot].base_type == OBJ_MISCELLANY && you.inv[item_slot].sub_type != MISC_RUNE_OF_ZOT); - // Reset the warning counter. - you.received_weapon_warning = false; - // Prompt if not using the auto swap command, or if the swap slot // is empty. if (item_slot != PROMPT_GOT_SPECIAL && @@ -237,10 +228,35 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) canned_msg( MSG_OK ); return (false); } - else if (item_slot == PROMPT_GOT_SPECIAL) // '-' or bare hands + else if (item_slot == you.equip[EQ_WEAPON]) + { + mpr("You are already wielding that!"); + return (true); + } + + // now we really change weapons (most likely, at least) + if (you.duration[DUR_SURE_BLADE]) + { + mpr("The bond with your blade fades away."); + you.duration[DUR_SURE_BLADE] = 0; + } + // Reset the warning counter. + you.received_weapon_warning = false; + + if (item_slot == PROMPT_GOT_SPECIAL) // '-' or bare hands { if (you.equip[EQ_WEAPON] != -1) { + // can we safely unwield this item? + if (has_warning_inscription(you.inv[you.equip[EQ_WEAPON]], OPER_WIELD)) + { + std::string prompt = "Really unwield "; + prompt += you.inv[you.equip[EQ_WEAPON]].name(DESC_INVENTORY); + prompt += '?'; + if (!yesno(prompt.c_str(), false, 'n')) + return (false); + } + if (!unwield_item(show_weff_messages)) return (false); @@ -256,15 +272,13 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) return (true); } - if (item_slot == you.equip[EQ_WEAPON]) - { - mpr("You are already wielding that!"); - return (true); - } - if (!can_wield(&you.inv[item_slot], true)) return (false); + // for non-auto_wield cases checked above + if (auto_wield && !check_warning_inscriptions(you.inv[item_slot], OPER_WIELD)) + return (false); + if (!safe_to_remove_or_wear(you.inv[item_slot], false)) return (false); |