summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-18 19:58:02 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-18 19:58:02 +0000
commit77a23de544182bfc1b02c64f5209c60cde1eec25 (patch)
treeece7a8b8408dd2d068da016f50680d58cd2efb48
parent34ed092618e212e0aa6dd26a499233f566b7f78f (diff)
downloadcrawl-ref-77a23de544182bfc1b02c64f5209c60cde1eec25.tar.gz
crawl-ref-77a23de544182bfc1b02c64f5209c60cde1eec25.zip
Move the HALF_MAX_PIETY define to religion.h, as it's used with Xom in
several places outside xom.cc. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9639 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc4
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/religion.cc2
-rw-r--r--crawl-ref/source/religion.h5
-rw-r--r--crawl-ref/source/xom.cc10
5 files changed, 11 insertions, 12 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 8d5bf039c1..3951610e5b 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -545,9 +545,9 @@ static void _do_wizard_command(int wiz_command, bool silent_fail)
case 'X':
if (you.religion == GOD_XOM)
- xom_acts(abs(you.piety - 100));
+ xom_acts(abs(you.piety - HALF_MAX_PIETY));
else
- xom_acts(coinflip(), random_range(0, MAX_PIETY/2));
+ xom_acts(coinflip(), random_range(0, HALF_MAX_PIETY));
break;
case 'p':
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index b47442fe65..04b8cbed51 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -3048,7 +3048,7 @@ bool card_effect(card_type which_card, deck_rarity_type rarity,
if (you.religion == GOD_XOM && !rc)
{
god_speaks(GOD_XOM, "\"How boring, let's spice things up a little.\"");
- xom_acts(abs(you.piety - 100));
+ xom_acts(abs(you.piety - HALF_MAX_PIETY));
}
if (you.religion == GOD_NEMELEX_XOBEH && !rc)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 71de0d3f88..ba7fd58626 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -6632,7 +6632,7 @@ void god_pitch(god_type which_god)
if (you.religion == GOD_XOM)
{
// Xom uses piety and gift_timeout differently.
- you.piety = (MAX_PIETY / 2);
+ you.piety = HALF_MAX_PIETY;
you.gift_timeout = random2(40) + random2(40);
}
else
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 32bfb1e152..df3fc18451 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -14,8 +14,9 @@
#include "ouch.h"
#include "externs.h"
-#define MAX_PIETY 200
-#define MAX_PENANCE 200
+#define HALF_MAX_PIETY 100
+#define MAX_PIETY 200
+#define MAX_PENANCE 200
enum harm_protection_type
{
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 933a40eab2..1c5af19b4a 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -60,8 +60,6 @@ REVISION("$Rev$");
# define DEBUG_GIFTS 1
#endif
-#define HALF_MAX_PIETY MAX_PIETY / 2
-
// Which spells? First I copied all spells from your_spells(), and then
// I filtered some out, especially conjurations. Then I sorted them in
// roughly ascending order of power.
@@ -180,9 +178,9 @@ bool xom_is_nice(int tension)
// at zero tension the opposite.
const int tension_bonus
= (tension == -1 ? 0 :
- tension == 0 ? -std::min(abs(HALF_MAX_PIETY - you.piety)/2,
- you.piety/10)
- : std::min((MAX_PIETY - you.piety)/2,
+ tension == 0 ? -std::min(abs(HALF_MAX_PIETY - you.piety) / 2,
+ you.piety / 10)
+ : std::min((MAX_PIETY - you.piety) / 2,
random2(tension)));
#ifdef DEBUG_XOM
@@ -2982,7 +2980,7 @@ void xom_acts(bool niceness, int sever, int tension)
if (you.religion == GOD_XOM && one_chance_in(5))
{
const std::string old_xom_favour = describe_xom_favour();
- you.piety = random2(MAX_PIETY+1);
+ you.piety = random2(MAX_PIETY + 1);
const std::string new_xom_favour = describe_xom_favour();
if (was_bored || old_xom_favour != new_xom_favour)
{