From b7861f247d877def85b5efb072fba62fab079eb7 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Sat, 29 Mar 2008 08:46:19 +0000 Subject: For 1923865 Add fire_quiver_best option (default false). If true, use oldtimer behavior where quiver always contains the best-ranked missile. See manual, options, init.txt. Docs switch back and forth a bit between calling ( ammunition or missiles; moved a few uses to missiles. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3935 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 5 +++++ crawl-ref/source/command.cc | 17 +++++------------ crawl-ref/source/externs.h | 1 + crawl-ref/source/initfile.cc | 7 ++++++- crawl-ref/source/item_use.cc | 12 +++++++----- 5 files changed, 24 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index a08c5aeb77..8fa1480ddd 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2377,6 +2377,11 @@ void process_command( command_type cmd ) case CMD_CYCLE_QUIVER_FORWARD: { + if (Options.fire_quiver_best) + { + mpr("Use fire_quiver_best=false if you want manual quiver control."); + break; + } const int cur = you.quiver[get_quiver_type()]; if (cur != ENDOFPACK) { diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 00432ead51..485df76827 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -52,7 +52,7 @@ #include "version.h" #include "view.h" -static void adjust_item(void); +static void _adjust_item(void); static void adjust_spells(void); static void adjust_ability(void); static void list_wizard_commands(); @@ -107,7 +107,7 @@ void adjust(void) const int keyin = tolower( get_ch() ); if (keyin == 'i') - adjust_item(); + _adjust_item(); else if (keyin == 's') adjust_spells(); else if (keyin == 'a') @@ -152,18 +152,11 @@ void swap_inv_slots(int from_slot, int to_slot, bool verbose) if (to_slot == you.equip[EQ_WEAPON] || from_slot == you.equip[EQ_WEAPON]) { you.wield_change = true; - you.quiver_change = true; } - if (!you.quiver_change) - { - int quiver = you.quiver[get_quiver_type()]; - if (to_slot == quiver || from_slot == quiver) - you.quiver_change = true; - } - + you.quiver_change = true; } -static void adjust_item(void) +static void _adjust_item(void) { int from_slot, to_slot; @@ -195,7 +188,7 @@ static void adjust_item(void) } swap_inv_slots(from_slot, to_slot, true); -} // end adjust_item() +} // end _adjust_item() static void adjust_spells(void) { diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index d8bb41f6d6..c6eed59f14 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1615,6 +1615,7 @@ public: int fire_items_start;// index of first item for fire command std::vector fire_order; // missile search order for 'f' command + bool fire_quiver_best; bool auto_list; // automatically jump to appropriate item lists diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 296d30fdba..fa50bf5ab3 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -767,6 +767,7 @@ void game_options::reset_options() flush_input[ FLUSH_LUA ] = true; fire_items_start = 0; // start at slot 'a' + fire_quiver_best = false; // Clear fire_order and set up the defaults. set_fire_order("launcher, return, " @@ -1997,10 +1998,14 @@ void game_options::read_option_line(const std::string &str, bool runscript) fire_items_start = letter_to_index( field[0] ); else { - fprintf( stderr, "Bad fire item start index -- %s\n", + fprintf( stderr, "Bad fire item start index: %s\n", field.c_str() ); } } + else if (key == "fire_quiver_best") + { + fire_quiver_best = _read_bool(field, fire_quiver_best); + } else if (key == "assign_item_slot") { if (field == "forward") diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index e2dbb09aa8..162adce4b1 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1359,11 +1359,13 @@ int get_current_fire_item() if (fire_order.size() == 0) return ENDOFPACK; - const int q = you.quiver[get_quiver_type()]; - for (unsigned i = 0; i < fire_order.size(); i++) - if (q == fire_order[i]) - return q; - + if (! Options.fire_quiver_best) + { + const int q = you.quiver[get_quiver_type()]; + for (unsigned i = 0; i < fire_order.size(); i++) + if (q == fire_order[i]) + return q; + } return fire_order[0]; } -- cgit v1.2.3-54-g00ecf