diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-13 20:24:52 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-13 20:24:52 +0000 |
commit | 05778102b466f438185552dfb314423635fdf8a6 (patch) | |
tree | a107d01fb0a63a3e39656417539b2633527d1bbf /crawl-ref/source/religion.cc | |
parent | 888862b18bb90bc415fc308809e73111881b78fa (diff) | |
download | crawl-ref-05778102b466f438185552dfb314423635fdf8a6.tar.gz crawl-ref-05778102b466f438185552dfb314423635fdf8a6.zip |
Fix for 1661786: autoprayer now works with run delays.
Perhaps we should a note to the docs mentioning the possibility
of setting runrest_ignore_message appropriately to make it
work well with autoprayer.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1032 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r-- | crawl-ref/source/religion.cc | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 85ee1d99bd..b7dec5523c 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -593,7 +593,7 @@ static void do_god_gift() void pray(void) { - unsigned char was_praying = you.duration[DUR_PRAYER]; + const bool was_praying = (you.duration[DUR_PRAYER] != 0); if (silenced(you.x_pos, you.y_pos)) { @@ -601,15 +601,15 @@ void pray(void) return; } - // all prayers take time + // almost all prayers take time you.turn_is_over = true; - if (you.religion != GOD_NO_GOD - && grid_altar_god(grd[you.x_pos][you.y_pos]) == you.religion) + const god_type altar_god = grid_altar_god(grd[you.x_pos][you.y_pos]); + if (you.religion != GOD_NO_GOD && altar_god == you.religion) { altar_prayer(); } - else if (grid_altar_god(grd[you.x_pos][you.y_pos]) != GOD_NO_GOD) + else if (altar_god != GOD_NO_GOD) { if (you.species == SP_DEMIGOD) { @@ -622,13 +622,9 @@ void pray(void) if (you.religion == GOD_NO_GOD) { - strcpy(info, "You spend a moment contemplating the meaning of "); - - if (you.is_undead) - strcat(info, "un"); - - strcat(info, "life."); - mpr(info, MSGCH_PRAY); + mprf(MSGCH_PRAY, + "You spend a moment contemplating the meaning of %slife.", + you.is_undead ? "un" : ""); // Zen meditation is timeless. you.turn_is_over = false; @@ -660,14 +656,11 @@ void pray(void) return; } - strcpy( info, "You offer a prayer to " ); - strcat( info, god_name( you.religion ) ); - strcat( info, "." ); - mpr(info, MSGCH_PRAY); + mprf(MSGCH_PRAY, "You offer a prayer to %s.", god_name(you.religion)); you.duration[DUR_PRAYER] = 9 + (random2(you.piety) / 20) + (random2(you.piety) / 20); - + if (player_under_penance()) simple_god_message(" demands penance!"); else @@ -693,8 +686,7 @@ void pray(void) } #if DEBUG_DIAGNOSTICS - snprintf( info, INFO_SIZE, "piety: %d", you.piety ); - mpr( info, MSGCH_DIAGNOSTICS ); + mprf(MSGCH_DIAGNOSTICS, "piety: %d", you.piety ); #endif if (!was_praying) |