From f68c32e264f3f32ed30a177f0118c6134391cffe Mon Sep 17 00:00:00 2001 From: Neil Moore Date: Sun, 3 Aug 2014 19:33:50 -0400 Subject: Allow autosacrifice on altars and when silenced (minmay) In the former case, without displaying the normal altar prompts. --- crawl-ref/source/delay.cc | 2 +- crawl-ref/source/godprayer.cc | 8 ++++---- crawl-ref/source/godprayer.h | 2 +- crawl-ref/source/travel.cc | 16 ++++------------ 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 2cfe33d0f0..692c498797 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -1296,7 +1296,7 @@ static void _handle_run_delays(const delay_queue_item &delay) if (lev && lev->sacrificeable(you.pos())) { const interrupt_block block_interrupts; - pray(); + pray(false); return; } } diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc index a4303ce00f..23cb0fac3f 100644 --- a/crawl-ref/source/godprayer.cc +++ b/crawl-ref/source/godprayer.cc @@ -375,21 +375,21 @@ static void _zen_meditation() * Pray. (To your god, or the god of the altar you're at, or to Beogh, if * you're an orc being preached at.) */ -void pray() +void pray(bool allow_altar_prayer) { // only successful prayer takes time you.turn_is_over = false; // try to pray to an altar (if any is present) - if (_altar_pray_or_convert()) + if (allow_altar_prayer && _altar_pray_or_convert()) { you.turn_is_over = true; return; } // convert to beogh via priest. - if (you_worship(GOD_NO_GOD) && env.level_state & LSTATE_BEOGH - && can_convert_to_beogh()) + if (allow_altar_prayer && you_worship(GOD_NO_GOD) + && (env.level_state & LSTATE_BEOGH) && can_convert_to_beogh()) { // TODO: deduplicate this with the code in _altar_pray_or_convert. you.turn_is_over = true; diff --git a/crawl-ref/source/godprayer.h b/crawl-ref/source/godprayer.h index b865da16ea..c097c39a86 100644 --- a/crawl-ref/source/godprayer.h +++ b/crawl-ref/source/godprayer.h @@ -9,7 +9,7 @@ #include "religion-enum.h" string god_prayer_reaction(); -void pray(); +void pray(bool allow_altar_prayer = true); piety_gain_t sacrifice_item_stack(const item_def& item, int *js = 0, int quantity = 0); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 5a53ebf797..4fc4564afa 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -908,13 +908,6 @@ void explore_pickup_event(int did_pickup, int tried_pickup) } } -static bool _can_sacrifice(const coord_def p) -{ - const dungeon_feature_type feat = grd(p); - return !you.cannot_speak() - && (!feat_is_altar(feat) || feat_is_player_altar(feat)); -} - static bool _sacrificeable_at(const coord_def& p) { for (stack_iterator si(p, true); si; ++si) @@ -1040,7 +1033,7 @@ command_type travel() if ((stack && _prompt_stop_explore(ES_GREEDY_VISITED_ITEM_STACK) || sacrificeable && _prompt_stop_explore(ES_GREEDY_SACRIFICEABLE)) && (Options.auto_sacrifice != AS_YES || !sacrificeable - || stack || !_can_sacrifice(newpos))) + || stack)) { explore_stopped_pos = newpos; stop_running(); @@ -3035,7 +3028,7 @@ void start_explore(bool grab_items) && (Options.auto_sacrifice == AS_YES || Options.auto_sacrifice == AS_BEFORE_EXPLORE))) { - pray(); + pray(false); } } @@ -3059,10 +3052,9 @@ void start_explore(bool grab_items) if ((Options.auto_sacrifice == AS_YES || Options.auto_sacrifice == AS_BEFORE_EXPLORE || Options.auto_sacrifice == AS_PROMPT - && yesno("Do you want to sacrifice the items here? ", true, 'n')) - && _can_sacrifice(you.pos())) + && yesno("Do you want to sacrifice the items here? ", true, 'n'))) { - pray(); + pray(false); } else if (Options.auto_sacrifice == AS_PROMPT_IGNORE) { -- cgit v1.2.3-54-g00ecf