diff options
-rw-r--r-- | crawl-ref/docs/options_guide.txt | 13 | ||||
-rw-r--r-- | crawl-ref/settings/init.txt | 3 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/delay.cc | 49 | ||||
-rw-r--r-- | crawl-ref/source/delay.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 8 | ||||
-rw-r--r-- | crawl-ref/source/food.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 19 |
9 files changed, 75 insertions, 32 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt index adafbf6a2a..e7d6130b5e 100644 --- a/crawl-ref/docs/options_guide.txt +++ b/crawl-ref/docs/options_guide.txt @@ -812,6 +812,12 @@ trap_prompt = true stepping on a mechanical trap. Note that you'll always be prompted for non-mechanical traps. +rest_wait_both = false + If rest_wait_both is set to true then resting will only stop + when both HP and MP are fully restored, not when either one of + them is restored. + + 4-h Stashes. ---------------- @@ -890,6 +896,13 @@ always_confirm_butcher = false one corpse on the square. If there are multiple corpses on a square, you will always be prompted, regardless of this option. +chunks_autopickup = false + If true then butchered flesh will be autopickup'd right after + they're generated (and after switching back from the + butchering weapon to usual weapon, if necessary). Respects + all of the autopickup options. Requires '%' to be in the + autopickup line. + easy_quit_item_prompts = true Setting this option to true allows the quitting of item listing with Space (as well as Escape, which always works). These lists diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt index 935c3eaac1..dd80b3a3c2 100644 --- a/crawl-ref/settings/init.txt +++ b/crawl-ref/settings/init.txt @@ -185,6 +185,8 @@ runrest_ignore_monster = butterfly:0 # trap_prompt = false trapwalk_safe_hp = dart:20,needle:15,arrow:35,bolt:45,spear:40,axe:45,blade:95 +#rest_wait_both = true + # The file (travel_stoppers.txt) contains a list of travel_stop_message # settings, with brief descriptions of what they do. include = travel_stoppers.txt @@ -203,6 +205,7 @@ include = travel_stoppers.txt # easy_confirm = (none | safe) # easy_butcher = false # always_confirm_butcher = true +# chunks_autopickup = true # easy_quit_item_prompts = false # easy_exit_menu = false # default_autoprayer = true diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 6dfa3d0680..d0f1ea51eb 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3038,8 +3038,6 @@ static void _world_reacts() { inc_hp(1, false); tmp -= 100; - - you.running.check_hp(); } ASSERT( tmp >= 0 && tmp < 100 ); @@ -3056,8 +3054,6 @@ static void _world_reacts() { inc_mp(1, false); tmp -= 100; - - you.running.check_mp(); } ASSERT( tmp >= 0 && tmp < 100 ); diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 75b3fe6be7..29be88c450 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -48,6 +48,8 @@ extern std::vector<SelItem> items_for_multidrop; +static int _interrupts_blocked = 0; + static void xom_check_corpse_waste(); static void armour_wear_effects(const int item_inv_slot); static void handle_run_delays(const delay_queue_item &delay); @@ -284,6 +286,8 @@ void start_delay( delay_type type, int turns, int parm1, int parm2 ) { ASSERT(!crawl_state.is_repeating_cmd() || type == DELAY_MACRO); + _interrupts_blocked = 0; // Just to be safe + delay_queue_item delay; delay.type = type; @@ -307,6 +311,8 @@ void start_delay( delay_type type, int turns, int parm1, int parm2 ) void stop_delay( bool stop_stair_travel ) /*********************/ { + _interrupts_blocked = 0; // Just to be safe + if (you.delay_queue.empty()) return; @@ -1110,6 +1116,14 @@ static void finish_delay(const delay_queue_item &delay) mpr("You enjoyed that."); you.berserk_penalty = 0; } + + // Don't atuopickup chunks if there's a weapon-swap delay + // waiting to happen. + if (Options.chunks_autopickup + && you.delay_queue.size() == 1) + { + autopickup(); + } } } else @@ -1535,12 +1549,28 @@ static bool should_stop_activity(const delay_queue_item &item, delay_type curr = current_delay_action(); - if (curr != DELAY_REST && (ai == AI_FULL_HP || ai == AI_FULL_MP)) - return false; - else if (ai == AI_SEE_MONSTER && (curr == DELAY_ASCENDING_STAIRS || - curr == DELAY_DESCENDING_STAIRS)) + if (ai == AI_SEE_MONSTER && (curr == DELAY_ASCENDING_STAIRS || + curr == DELAY_DESCENDING_STAIRS)) return false; + if (ai == AI_FULL_HP || ai == AI_FULL_MP) + { + // No recursive interruptions from messages (AI_MESSAGE) + block_interruptions(true); + if (ai == AI_FULL_HP) + mpr("HP restored."); + else + mpr("Magic restored."); + block_interruptions(false); + + if (Options.rest_wait_both && curr == DELAY_REST + && (you.magic_points < you.max_magic_points + || you.hp < you.hp_max)) + { + return false; + } + } + return (ai == AI_FORCE_INTERRUPT || Options.activity_interrupts[item.type][ai]); } @@ -1658,6 +1688,9 @@ static void paranoid_option_disable( activity_interrupt_type ai, bool interrupt_activity( activity_interrupt_type ai, const activity_interrupt_data &at ) { + if (_interrupts_blocked > 0) + return false; + paranoid_option_disable(ai, at); if (crawl_state.is_repeating_cmd()) @@ -1795,3 +1828,11 @@ const char *delay_name(int delay) return delay_names[delay]; } + +void block_interruptions(bool block) +{ + if (block) + _interrupts_blocked++; + else + _interrupts_blocked--; +} diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h index 44df52435c..01e4d6c7ea 100644 --- a/crawl-ref/source/delay.h +++ b/crawl-ref/source/delay.h @@ -93,4 +93,5 @@ bool interrupt_activity( activity_interrupt_type ai, const activity_interrupt_data &a = activity_interrupt_data() ); +void block_interruptions(bool block); #endif diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 830abc75e4..ccf8d5c8bb 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -489,10 +489,6 @@ public: // Returns true if you were running and are now no longer running. bool check_stop_running(); - // Check if we've reached the HP/MP stop-rest condition - void check_hp(); - void check_mp(); - private: void set_run_check(int index, int compass_dir); bool run_grids_changed() const; @@ -1640,6 +1636,7 @@ public: bool easy_unequip; // allow auto-removing of armour / jewellery bool easy_butcher; // autoswap to butchering tool bool always_confirm_butcher; // even if only one corpse + bool chunks_autopickup; // Autopickup chunks after butchering bool list_rotten; // list slots for rotting corpses/chunks bool default_target; // start targeting on a real target bool autopickup_no_burden; // don't autopickup if it changes burden @@ -1815,6 +1812,9 @@ public: // If the player prefers to merge kill records, this option can do that. int kill_map[KC_NCATEGORIES]; + bool rest_wait_both; // Stop resting only when both HP and MP are + // fully restored. + #ifdef WIZARD // Parameters for fight simulations. long fsim_rounds; diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index ab16de1dc8..00cbf52926 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -160,6 +160,9 @@ void weapon_switch( int targ ) // special checks: staves of power, etc if (targ != -1) wield_effects( targ, false ); + + if (Options.chunks_autopickup) + autopickup(); } // look for a butchering implement. If fallback is true, diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 841e78e782..f6be423732 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -485,7 +485,7 @@ void game_options::set_default_activity_interrupts() "interrupt_travel = interrupt_butcher, statue, hungry, " "burden, monster, hit_monster", "interrupt_run = interrupt_travel, message", - "interrupt_rest = interrupt_run", + "interrupt_rest = interrupt_run, full_hp, full_mp", // Stair ascents/descents cannot be interrupted, attempts to interrupt // the delay will just trash all queued delays, including travel. @@ -671,6 +671,7 @@ void game_options::reset_options() easy_unequip = true; easy_butcher = true; always_confirm_butcher = false; + chunks_autopickup = false; list_rotten = true; easy_confirm = CONFIRM_SAFE_EASY; easy_quit_item_prompts = true; @@ -886,6 +887,8 @@ void game_options::reset_options() clear_feature_overrides(); mon_glyph_overrides.clear(); + rest_wait_both = false; + // Map each category to itself. The user can override in init.txt kill_map[KC_YOU] = KC_YOU; kill_map[KC_FRIENDLY] = KC_FRIENDLY; @@ -1875,6 +1878,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) else BOOL_OPTION_NAMED("easy_armor", easy_unequip); else BOOL_OPTION(easy_butcher); else BOOL_OPTION(always_confirm_butcher); + else BOOL_OPTION(chunks_autopickup); else BOOL_OPTION(list_rotten); else if (key == "lua_file" && runscript) { @@ -2568,6 +2572,7 @@ void game_options::read_option_line(const std::string &str, bool runscript) } } } + else BOOL_OPTION(rest_wait_both); else if (key == "dump_message_count") { // Capping is implicit diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 3b5a0f36ba..8eb88c5bff 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -3831,25 +3831,6 @@ void runrest::clear() _reset_zigzag_info(); } -void runrest::check_hp() -{ - if (is_rest() && you.hp == you.hp_max && you.hp > hp) - { - mpr("HP restored."); - stop(); - } -} - -void runrest::check_mp() -{ - if (is_rest() && you.magic_points == you.max_magic_points - && you.magic_points > mp) - { - mpr("Magic restored."); - stop(); - } -} - ///////////////////////////////////////////////////////////////////////////// // explore_discoveries |