summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/religion.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-13 17:14:35 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-13 17:14:35 +0000
commit429cc16cb83f54b3f983e151ce1f080b2a3e8ec0 (patch)
treeae0f9519ca6d905d6fa8e8b0d1a6caa8ae260c65 /crawl-ref/source/religion.cc
parente7f07ca39819b9370578f0ceb71ba86f0ce8e801 (diff)
downloadcrawl-ref-429cc16cb83f54b3f983e151ce1f080b2a3e8ec0.tar.gz
crawl-ref-429cc16cb83f54b3f983e151ce1f080b2a3e8ec0.zip
* Add a tile for detected secret doors as suggested by zebez, then turned
the idea on its head. * Fix corpses getting the wrong blood stain background tile (also a patch by zebez), and change around the colours a bit: a red blood stain now shows that Vampires can drain the corpse, undrainable corpses get the green background instead * Apply a small patch by Josh Triplett to give more appropriate messages when glowing weapons are sacrificed and disappear "without a glow" git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10209 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/religion.cc')
-rw-r--r--crawl-ref/source/religion.cc35
1 files changed, 28 insertions, 7 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 5fca7f4e09..33642707a1 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -90,6 +90,7 @@ REVISION("$Rev$");
// Item offering messages for the gods:
// & is replaced by "is" or "are" as appropriate for the item.
// % is replaced by "s" or "" as appropriate.
+// Text between [] only appears if the item already glows.
// <> and </> are replaced with colors.
// First message is if there's no piety gain; second is if piety gain is
// one; third is if piety gain is more than one.
@@ -115,7 +116,7 @@ static const char *_Sacrifice_Messages[NUM_GODS][NUM_PIETY_GAIN] =
},
// TSO
{
- " faintly glow% and disappear%.",
+ " glow% a dingy golden colour and disappear%.",
" glow% a golden colour and disappear%.",
" glow% a brilliant golden colour and disappear%.",
},
@@ -157,9 +158,9 @@ static const char *_Sacrifice_Messages[NUM_GODS][NUM_PIETY_GAIN] =
},
// Sif Muna
{
- " & gone without a glow.",
- " glow% faintly for a moment, and & gone.",
- " glow% for a moment, and & gone.",
+ " & gone without a[dditional] glow.",
+ " glow% slightly [brighter ]for a moment, and & gone.",
+ " glow% [brighter ]for a moment, and & gone.",
},
// Trog
{
@@ -169,8 +170,8 @@ static const char *_Sacrifice_Messages[NUM_GODS][NUM_PIETY_GAIN] =
},
// Nemelex
{
- " disappear% without a glow.",
- " glow% slightly and disappear%.",
+ " disappear% without a[dditional] glow.",
+ " glow% slightly [brighter ]and disappear%.",
" glow% with a rainbow of weird colours and disappear%.",
},
// Elyvilon (no sacrifices, but used for weapon destruction)
@@ -6191,10 +6192,30 @@ static void _replace(std::string& s,
}
}
+static void _erase_between(std::string& s,
+ const std::string &left,
+ const std::string &right)
+{
+ std::string::size_type left_pos;
+ std::string::size_type right_pos;
+
+ while ((left_pos = s.find(left)) != std::string::npos
+ && (right_pos = s.find(right, left_pos + left.size())) != std::string::npos)
+ s.erase(s.begin() + left_pos, s.begin() + right_pos + right.size());
+}
+
static void _print_sacrifice_message(god_type god, const item_def &item,
piety_gain_t piety_gain, bool your)
{
std::string msg(_Sacrifice_Messages[god][piety_gain]);
+ std::string itname = item.name(your ? DESC_CAP_YOUR : DESC_CAP_THE);
+ if (itname.find("glowing") != std::string::npos)
+ {
+ _replace(msg, "[", "");
+ _replace(msg, "]", "");
+ }
+ else
+ _erase_between(msg, "[", "]");
_replace(msg, "%", (item.quantity == 1? "s" : ""));
_replace(msg, "&", (item.quantity == 1? "is" : "are"));
const char *tag_start, *tag_end;
@@ -6214,7 +6235,7 @@ static void _print_sacrifice_message(god_type god, const item_def &item,
break;
}
- msg.insert(0, item.name(your ? DESC_CAP_YOUR : DESC_CAP_THE));
+ msg.insert(0, itname);
msg = tag_start + msg + tag_end;
formatted_message_history(msg, MSGCH_GOD);