diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-14 22:04:34 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-14 22:04:34 +0000 |
commit | 39f1638a065766fa67c70871c95a0a8400f044f1 (patch) | |
tree | 29de7d191f59b1c55842b25bee2f225e5de1b169 /crawl-ref/source/monspeak.cc | |
parent | 1c7787b17cee82ed787ff5fed1eea5c943c0cd64 (diff) | |
download | crawl-ref-39f1638a065766fa67c70871c95a0a8400f044f1.tar.gz crawl-ref-39f1638a065766fa67c70871c95a0a8400f044f1.zip |
Apply Horst von Brand's (first) patch 1887488: gcc-4.3 compile failures.
I'm not sure what to do about the rest of that tracker item.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4233 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monspeak.cc')
-rw-r--r-- | crawl-ref/source/monspeak.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc index da4fba4f4e..06910e7c50 100644 --- a/crawl-ref/source/monspeak.cc +++ b/crawl-ref/source/monspeak.cc @@ -15,6 +15,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <algorithm> #ifdef DOS #include <conio.h> @@ -118,10 +119,10 @@ static std::string _get_speak_string(const std::vector<std::string> prefixes, const monsters *monster) { std::string msg = _try_exact_string(prefixes, key); - + if (!msg.empty()) return msg; - + // Combinations of prefixes by threes const int size = prefixes.size(); std::string prefix = ""; @@ -136,7 +137,7 @@ static std::string _get_speak_string(const std::vector<std::string> prefixes, prefix += prefixes[k] + " "; msg = getSpeakString("default " + prefix + key); - + if (!msg.empty()) return msg; } @@ -152,7 +153,7 @@ static std::string _get_speak_string(const std::vector<std::string> prefixes, prefix += prefixes[j] + " "; msg = getSpeakString("default " + prefix + key); - + if (!msg.empty()) return msg; } @@ -166,7 +167,7 @@ static std::string _get_speak_string(const std::vector<std::string> prefixes, prefix = prefixes[i] + " "; msg = getSpeakString("default " + prefix + key); - + if (!msg.empty()) return msg; } @@ -235,14 +236,14 @@ bool mons_speaks(const monsters *monster) // charmed monsters aren't too expressive if (monster->has_ench(ENCH_CHARM) && !one_chance_in(3)) return false; - + std::vector<std::string> prefixes; if (mons_neutral(monster)) { if (coinflip()) // neutrals speak half as often return false; - + prefixes.push_back("neutral"); } else if (mons_friendly(monster)) @@ -358,7 +359,7 @@ bool mons_speaks(const monsters *monster) key += "'"; msg = _get_speak_string(prefixes, key, monster); } - + if (msg == "__NONE") { #ifdef DEBUG_MONSPEAK @@ -410,7 +411,7 @@ bool mons_speaks(const monsters *monster) if (msg.empty() || msg == "__NEXT") msg = _get_speak_string(prefixes, get_mon_shape_str(shape), monster); - + if (msg == "__NONE") { #ifdef DEBUG_MONSPEAK @@ -442,7 +443,7 @@ bool mons_speaks(const monsters *monster) msg2 = _get_speak_string(prefixes, get_mon_shape_str(shape), monster); - + if (msg == "__NONE" && msg2 == "__NONE") { #ifdef DEBUG_MONSPEAK @@ -490,7 +491,7 @@ bool mons_speaks(const monsters *monster) for (int i = 0, size = lines.size(); i < size; i++) { std::string line = lines[i]; - + // This function is a little bit of a problem for the message // channels since some of the messages it generates are "fake" // warning to scare the player. In order to accomidate this |