From e426b1b518bd6fded95d320aa188ed564861877f Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 7 Oct 2008 19:55:50 +0000 Subject: Consolidate prayer-ending routines. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7177 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 5 +---- crawl-ref/source/religion.cc | 12 +++++++----- crawl-ref/source/religion.h | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 2b4355621a..01dfd41993 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2577,10 +2577,7 @@ static void _decrement_durations() if (you.duration[DUR_PRAYER] > 1) you.duration[DUR_PRAYER]--; else if (you.duration[DUR_PRAYER] == 1) - { - mpr("Your prayer is over.", MSGCH_PRAY, you.religion); - you.duration[DUR_PRAYER] = 0; - } + end_prayer(); if (you.duration[DUR_DIVINE_SHIELD]) { diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index d097267b68..6c6cc5978c 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2129,8 +2129,13 @@ void pray() #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "piety: %d (-%d)", you.piety, you.piety_hysteresis ); #endif +} -} // end pray() +void end_prayer(void) +{ + mpr("Your prayer is over.", MSGCH_PRAY, you.religion); + you.duration[DUR_PRAYER] = 0; +} std::string god_name( god_type which_god, bool long_name ) { @@ -3481,10 +3486,7 @@ void lose_piety(int pgn) } if (!_god_accepts_prayer(you.religion)) - { - mpr("Your prayer is over.", MSGCH_PRAY, you.religion); - you.duration[DUR_PRAYER] = 0; - } + end_prayer(); if (you.piety > 0 && you.piety <= 5) learned_something_new(TUT_GOD_DISPLEASED); diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h index 1276501f85..011a85d752 100644 --- a/crawl-ref/source/religion.h +++ b/crawl-ref/source/religion.h @@ -77,6 +77,7 @@ void lose_piety(int pgn); void offer_corpse(int corpse); std::string god_prayer_reaction(); void pray(); +void end_prayer(); void handle_god_time(void); int god_colour(god_type god); void god_pitch(god_type which_god); -- cgit v1.2.3-54-g00ecf