diff options
author | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2010-01-26 16:47:28 +0100 |
---|---|---|
committer | Johanna Ploog <j-p-e-g@users.sourceforge.net> | 2010-01-26 16:52:31 +0100 |
commit | 889760fbfad75328c4450cd28355c94335078b4a (patch) | |
tree | 320ada4036d08ce2a4f83eac403d40dbfed7a8a8 /crawl-ref/source/quiver.cc | |
parent | 290e404fd6bed69402121e3164ebdf58c00e0759 (diff) | |
download | crawl-ref-889760fbfad75328c4450cd28355c94335078b4a.tar.gz crawl-ref-889760fbfad75328c4450cd28355c94335078b4a.zip |
Don't autoquiver the wielded weapon (if it's similar to the quiver one).
Diffstat (limited to 'crawl-ref/source/quiver.cc')
-rw-r--r-- | crawl-ref/source/quiver.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index e9a24c534c..5a0c061bf9 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -142,6 +142,14 @@ void player_quiver::empty_quiver(ammo_t ammo_type) you.redraw_quiver = true; } +static bool _wielded_slot_no_quiver(int slot) +{ + return (slot == you.equip[EQ_WEAPON] + && you.inv[slot].base_type == OBJ_WEAPONS + && (get_weapon_brand(you.inv[slot]) != SPWPN_RETURNING + || you.skills[SK_THROWING] == 0)); +} + void choose_item_for_quiver() { int slot = prompt_invent_item("Quiver which item? (- for none, * to show all)", @@ -165,10 +173,7 @@ void choose_item_for_quiver() "crossbow"); return; } - else if (slot == you.equip[EQ_WEAPON] - && you.inv[slot].base_type == OBJ_WEAPONS - && (get_weapon_brand(you.inv[slot]) != SPWPN_RETURNING - || you.skills[SK_THROWING] == 0)) + else if (_wielded_slot_no_quiver(slot)) { // Don't quiver a wielded weapon unless it's a weapon of returning // and we've got some throwing skill. @@ -562,23 +567,29 @@ static bool _item_matches(const item_def &item, fire_type types, // or -1 if not in inv. static int _get_pack_slot(const item_def& item) { - if (! item.is_valid()) + if (!item.is_valid()) return -1; // First try to find the exact same item. for (int i = 0; i < ENDOFPACK; i++) { const item_def& inv_item = you.inv[i]; - if (inv_item.quantity && _items_similar(item, you.inv[i], false)) + if (inv_item.quantity && _items_similar(item, you.inv[i], false) + && !_wielded_slot_no_quiver(i)) + { return i; + } } // If that fails, try to find an item sufficiently similar. for (int i = 0; i < ENDOFPACK; i++) { const item_def& inv_item = you.inv[i]; - if (inv_item.quantity && _items_similar(item, you.inv[i], true)) + if (inv_item.quantity && _items_similar(item, you.inv[i], true) + && !_wielded_slot_no_quiver(i)) + { return i; + } } return -1; |