diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-22 21:03:01 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-22 21:03:01 +0000 |
commit | 42d8d07399655f768c9547ed3f47f39623856291 (patch) | |
tree | cc2250fa7e40fc89e88d83de33644885ff301718 | |
parent | 910f0c606fea238e7382a713e0d465ae189c05ce (diff) | |
download | crawl-ref-42d8d07399655f768c9547ed3f47f39623856291.tar.gz crawl-ref-42d8d07399655f768c9547ed3f47f39623856291.zip |
Fix 2603266: Additional '(' needed for cycling ammo after emptying the
previously quivered stack.
FR 2594741: Make ')' cycle quiver backwards.
The previous behaviour has been moved to '}'.
The equipped inventory listing ']' now also includes the quivered item(s).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9164 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/acr.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/cmd-keys.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/cmd-name.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/item_use.h | 1 |
7 files changed, 24 insertions, 9 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index f0d0feeb78..381003f459 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1870,10 +1870,11 @@ void process_command( command_type cmd ) break; case CMD_CYCLE_QUIVER_FORWARD: + case CMD_CYCLE_QUIVER_BACKWARD: { - int cur; - you.m_quiver->get_desired_item(NULL, &cur); - const int next = get_next_fire_item(cur, +1); + int dir = (cmd == CMD_CYCLE_QUIVER_FORWARD ? +1 : -1); + int cur = you.m_quiver->get_fire_item(); + const int next = get_next_fire_item(cur, dir); #ifdef DEBUG_QUIVER mprf(MSGCH_DIAGNOSTICS, "next slot: %d, item: %s", next, next == -1 ? "none" : you.inv[next].name(DESC_PLAIN).c_str()); diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h index 892353d2f5..fbd51e72d9 100644 --- a/crawl-ref/source/cmd-keys.h +++ b/crawl-ref/source/cmd-keys.h @@ -101,7 +101,8 @@ {'[', CMD_LIST_ARMOUR}, {']', CMD_LIST_EQUIPMENT}, {'(', CMD_CYCLE_QUIVER_FORWARD}, -{')', CMD_LIST_WEAPONS}, +{')', CMD_CYCLE_QUIVER_BACKWARD}, +{'}', CMD_LIST_WEAPONS}, {'\\', CMD_DISPLAY_KNOWN_OBJECTS}, {'\'', CMD_WEAPON_SWAP}, {'`', CMD_PREV_CMD_AGAIN}, diff --git a/crawl-ref/source/cmd-name.h b/crawl-ref/source/cmd-name.h index 71845c40e6..ec1176d372 100644 --- a/crawl-ref/source/cmd-name.h +++ b/crawl-ref/source/cmd-name.h @@ -49,6 +49,7 @@ {CMD_WEAR_JEWELLERY, "CMD_WEAR_JEWELLERY"}, {CMD_REMOVE_JEWELLERY, "CMD_REMOVE_JEWELLERY"}, {CMD_CYCLE_QUIVER_FORWARD, "CMD_CYCLE_QUIVER_FORWARD"}, +{CMD_CYCLE_QUIVER_BACKWARD, "CMD_CYCLE_QUIVER_BACKWARD"}, {CMD_LIST_WEAPONS, "CMD_LIST_WEAPONS"}, {CMD_LIST_ARMOUR, "CMD_LIST_ARMOUR"}, {CMD_LIST_JEWELLERY, "CMD_LIST_JEWELLERY"}, diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index a570a0546a..cc0f2290ba 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -482,6 +482,7 @@ enum command_type CMD_WEAR_JEWELLERY, CMD_REMOVE_JEWELLERY, CMD_CYCLE_QUIVER_FORWARD, + CMD_CYCLE_QUIVER_BACKWARD, CMD_LIST_WEAPONS, CMD_LIST_ARMOUR, CMD_LIST_JEWELLERY, diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 7f2aeb0f94..e650b4dfa9 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -28,6 +28,7 @@ REVISION("$Rev$"); #include "describe.h" #include "food.h" #include "initfile.h" +#include "item_use.h" #include "itemprop.h" #include "items.h" #include "macro.h" @@ -764,12 +765,12 @@ unsigned char InvMenu::getkey() const ////////////////////////////////////////////////////////////////////////////// -bool in_inventory( const item_def &i ) +bool in_inventory(const item_def &i) { return i.pos.x == -1 && i.pos.y == -1; } -unsigned char get_invent( int invent_type ) +unsigned char get_invent(int invent_type) { unsigned char select; @@ -781,8 +782,8 @@ unsigned char get_invent( int invent_type ) if (isalpha(select)) { const int invidx = letter_to_index(select); - if ( is_valid_item(you.inv[invidx]) ) - describe_item( you.inv[invidx], true ); + if (is_valid_item(you.inv[invidx])) + describe_item( you.inv[invidx], true ); } else break; @@ -921,13 +922,17 @@ static bool _item_class_selected(const item_def &i, int selector) return (is_deck(i)); case OSEL_EQUIP: + { + if (item_is_quivered(i)) + return (true); + for (int eq = 0; eq < NUM_EQUIP; eq++) { if (you.equip[eq] == i.link) return (true); } return (false); - + } default: return (false); } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index c2d8273be1..41fdf840c1 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1223,6 +1223,11 @@ bool takeoff_armour(int item) return (true); } +bool item_is_quivered(const item_def &item) +{ + return (item.link == you.m_quiver->get_fire_item()); +} + int get_next_fire_item(int current, int direction) { std::vector<int> fire_order; diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h index e99d65181d..1dd4051855 100644 --- a/crawl-ref/source/item_use.h +++ b/crawl-ref/source/item_use.h @@ -103,6 +103,7 @@ bool remove_ring(int slot = -1, bool announce = false); /* *********************************************************************** * called from: acr * *********************************************************************** */ +bool item_is_quivered(const item_def &item); int get_next_fire_item(int current, int offset); int get_ammo_to_shoot(int item, dist &target, bool teleport = false); void fire_thing(int item = -1); |