summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.h
diff options
context:
space:
mode:
authorJay3.1415 <no@mail.com>2012-10-11 23:16:22 +0200
committerFlorian Diebold <flodiebold@gmail.com>2012-10-13 02:35:48 +0200
commita1a28680322a93c5607c8985e6934b47d01a4b75 (patch)
tree5432eff87a4aa73dce15f53838cf1d3cdd0939ab /crawl-ref/source/libutil.h
parent1656f8ec015d4a72b60fbb954b2cc7d71a389942 (diff)
downloadcrawl-ref-a1a28680322a93c5607c8985e6934b47d01a4b75.tar.gz
crawl-ref-a1a28680322a93c5607c8985e6934b47d01a4b75.zip
Improve speech syntax: capitalization and random substrings.
1. @The_monster@ shouts, "I hate you, @CAPS@ @player_name@ @NOCAPS@!" will result in the actual player name being capitalized. (Spaces are trimmed.) 2. @The_monster@ says, "I am [very ||really ] hungry." will randomly result in "I am very hungry", "I am hungry" or "I am really hungry". If the pattern turns up a lot, you need to assign weights to the different choices, or you require nested random sets, you'll need to stick to the old fallback of defining ad hoc @keywords@. Otherwise, this should make things somewhat simpler. Works for both monster and weapon speech, including shouts, noisy weapons and the Singing Sword. I've also taken the liberty to update the speech documentation, which still listed the old website (!) and pointed users looking for advice to the newsgroup). Conflicts: crawl-ref/source/art-func.h crawl-ref/source/libutil.cc crawl-ref/source/libutil.h Signed-off-by: Florian Diebold <flodiebold@gmail.com>
Diffstat (limited to 'crawl-ref/source/libutil.h')
-rw-r--r--crawl-ref/source/libutil.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index 440cf2ad53..77e967bc50 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -114,6 +114,9 @@ string replace_all(string s, const string &tofind, const string &replacement);
string replace_all_of(string s, const string &tofind, const string &replacement);
+string maybe_capitalize_substring(string s);
+string maybe_pick_random_substring(string s);
+
int count_occurrences(const string &text, const string &searchfor);
void play_sound(const char *file);