diff options
author | Haran Pilpel <haranp@users.sourceforge.net> | 2010-01-13 10:01:03 +0200 |
---|---|---|
committer | Haran Pilpel <haranp@users.sourceforge.net> | 2010-01-13 10:01:03 +0200 |
commit | cce3c6e018e1ec88a1b49eaf2fbfde88f51ada01 (patch) | |
tree | d075743f82d153e2c17f5da43d5e5fb0dffb1636 /crawl-ref/source/item_use.cc | |
parent | 253d9973468723045300b5025e2de1e96e350a99 (diff) | |
download | crawl-ref-cce3c6e018e1ec88a1b49eaf2fbfde88f51ada01.tar.gz crawl-ref-cce3c6e018e1ec88a1b49eaf2fbfde88f51ada01.zip |
Various cleanups, use you.weapon() more often, fix a note in README.txt.
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index f438fc122a..b161502515 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -321,15 +321,13 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, if (item_slot == PROMPT_GOT_SPECIAL) // '-' or bare hands { - if (you.equip[EQ_WEAPON] != -1) + if (const item_def* wpn = you.weapon()) { - item_def& wpn = *you.weapon(); // Can we safely unwield this item? - if (has_warning_inscription(wpn, OPER_WIELD)) + if (has_warning_inscription(*wpn, OPER_WIELD)) { - std::string prompt = "Really unwield "; - prompt += wpn.name(DESC_INVENTORY); - prompt += '?'; + const std::string prompt = + "Really unwield " + wpn->name(DESC_INVENTORY) + "?"; if (!yesno(prompt.c_str(), false, 'n')) return (false); } @@ -367,12 +365,13 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, if (!safe_to_remove_or_wear(new_wpn, false)) return (false); - // Go ahead and wield the weapon. - if (you.equip[EQ_WEAPON] != -1 && !unwield_item(show_weff_messages)) + // Unwield any old weapon. + if (you.weapon() && !unwield_item(show_weff_messages)) return (false); const unsigned int old_talents = your_talents(false).size(); + // Go ahead and wield the weapon. you.equip[EQ_WEAPON] = item_slot; // Any oddness on wielding taken care of here. |