summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-04 09:52:16 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-04 09:52:16 +0000
commit3814e798895a3c0349ad99d7eb697d290dcea03f (patch)
tree4b1b42cf2ca674cb7eb9c2e8f9d91490852ec5d5 /crawl-ref
parentf9ab2388128a21ff2f6cea0b4e82535af5a0f964 (diff)
downloadcrawl-ref-3814e798895a3c0349ad99d7eb697d290dcea03f.tar.gz
crawl-ref-3814e798895a3c0349ad99d7eb697d290dcea03f.zip
Some more code refactoring in god messages.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1214 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/chardump.cc15
-rw-r--r--crawl-ref/source/religion.cc35
-rw-r--r--crawl-ref/source/religion.h3
3 files changed, 26 insertions, 27 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index ab31941d55..3319e307ad 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -549,18 +549,9 @@ static void sdump_religion(const std::string &, std::string & text)
if (!player_under_penance())
{
- if (you.religion != GOD_XOM)
- { // Xom doesn't care
- text += god_name(you.religion);
- text += " is ";
- text += ((you.piety <= 5) ? "displeased" :
- (you.piety <= 20) ? "noncommittal" :
- (you.piety <= 40) ? "pleased with you" :
- (you.piety <= 70) ? "most pleased with you" :
- (you.piety <= 100) ? "greatly pleased with you" :
- (you.piety <= 130) ? "extremely pleased with you"
- : "exalted by your worship");
- text += ".";
+ if (you.religion != GOD_XOM) // Xom doesn't care
+ {
+ text += god_prayer_reaction();
text += "\n";
}
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 14909991a0..d185ed1733 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -603,7 +603,26 @@ static void do_god_gift()
} // end of gift giving
}
-void pray(void)
+std::string god_prayer_reaction()
+{
+ std::string result;
+ result += god_name(you.religion);
+ result += " is ";
+
+ result +=
+ (you.piety > 130) ? "exalted by your worship" :
+ (you.piety > 100) ? "extremely pleased with you" :
+ (you.piety > 70) ? "greatly pleased with you" :
+ (you.piety > 40) ? "most pleased with you" :
+ (you.piety > 20) ? "pleased with you" :
+ (you.piety > 5) ? "noncommittal"
+ : "displeased";
+
+ result += ".";
+ return result;
+}
+
+void pray()
{
const bool was_praying = (you.duration[DUR_PRAYER] != 0);
@@ -677,19 +696,7 @@ void pray(void)
simple_god_message(" demands penance!");
else
{
- strcpy(info, god_name(you.religion));
- strcat(info, " is ");
-
- strcat(info, (you.piety > 130) ? "exalted by your worship" :
- (you.piety > 100) ? "extremely pleased with you" :
- (you.piety > 70) ? "greatly pleased with you" :
- (you.piety > 40) ? "most pleased with you" :
- (you.piety > 20) ? "pleased with you" :
- (you.piety > 5) ? "noncommittal"
- : "displeased");
-
- strcat(info, ".");
- mpr( info, MSGCH_PRAY, you.religion );
+ mpr( god_prayer_reaction().c_str(), MSGCH_PRAY, you.religion );
if (you.piety > 130)
you.duration[DUR_PRAYER] *= 3;
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 0a8d565cca..5272a1383e 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -28,7 +28,8 @@ void gain_piety(char pgn);
void god_speaks( int god, const char *mesg );
void lose_piety(char pgn);
void offer_corpse(int corpse);
-void pray(void);
+std::string god_prayer_reaction();
+void pray();
void handle_god_time(void);
char god_colour(char god);
void god_pitch(unsigned char which_god);