diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-24 14:45:58 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-24 14:45:58 +0000 |
commit | 35c489ed9b277beaad1bf41e788a6f61ce03ccb1 (patch) | |
tree | 53866df32af1ecf0bcb7991c10bf7313d4e9f0b5 /crawl-ref/source/quiver.cc | |
parent | a117fb1baf5f81a56014a174f0400622cdf2ab5d (diff) | |
download | crawl-ref-35c489ed9b277beaad1bf41e788a6f61ce03ccb1.tar.gz crawl-ref-35c489ed9b277beaad1bf41e788a6f61ce03ccb1.zip |
Tweak quiver command some more (allow clearing quiver).
Update documentation.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6113 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/quiver.cc')
-rw-r--r-- | crawl-ref/source/quiver.cc | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index e22f5097c3..a125f15d6f 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -127,15 +127,23 @@ void player_quiver::set_quiver(const item_def &item, ammo_t ammo_type) { m_last_used_of_type[ammo_type] = item; m_last_used_of_type[ammo_type].quantity = 1; - m_last_used_type = ammo_type; + m_last_used_type = ammo_type; + you.redraw_quiver = true; +} + +void player_quiver::empty_quiver(ammo_t ammo_type) +{ + m_last_used_of_type[ammo_type] = item_def(); + m_last_used_of_type[ammo_type].quantity = 0; + m_last_used_type = ammo_type; you.redraw_quiver = true; } void choose_item_for_quiver() { - int slot = prompt_invent_item( "Quiver which item? (* to show all)", + int slot = prompt_invent_item( "Quiver which item? (- for none, * to show all)", MT_INVLIST, - OSEL_THROWABLE, true, true, true, 0, NULL, + OSEL_THROWABLE, true, true, true, '-', NULL, OPER_FIRE ); if (slot == PROMPT_ABORT) @@ -146,13 +154,25 @@ void choose_item_for_quiver() else if (slot == PROMPT_NOTHING) return; - const item_def item = you.inv[slot]; - - if (!is_valid_item(item)) + if (slot == PROMPT_GOT_SPECIAL) // '-' or empty quiver + { + ammo_t t = _get_weapon_ammo_type(you.weapon()); + you.m_quiver->empty_quiver(t); + + mprf("Emptying quiver for %s.", + t == AMMO_THROW ? "throwing" : + t == AMMO_BLOWGUN ? "blowguns" : + t == AMMO_SLING ? "slings" : + t == AMMO_BOW ? "bows" : + t == AMMO_CROSSBOW ? "crossbows" + : "hand crossbows"); return; + } - ammo_t t = AMMO_THROW; + const item_def item = you.inv[slot]; + ASSERT(is_valid_item(item)); + ammo_t t = AMMO_THROW; const item_def *weapon = you.weapon(); if (weapon && item.launched_by(*weapon)) t = _get_weapon_ammo_type(weapon); |