From 567cd92eae386c28b6af90121d0f8f575dce0687 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Tue, 20 Jan 2009 16:55:46 -0700 Subject: Repaired text messages. While trimming out the link code is still a good idea for the speech, I accidently trimmed it down to just the item name before. Signed-off-by: Ira Rice --- src/being.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 3e621295..7643c91b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -187,19 +187,16 @@ void Being::setSpeech(const std::string &text, Uint32 time) if (start != std::string::npos && end != std::string::npos) { - mSpeech.erase(end); - std::string::size_type pos = mSpeech.find('@'); + std::string::size_type position = mSpeech.find('|'); + mSpeech.erase(end, 1); + mSpeech.erase(start, (position - start) + 1); + position = mSpeech.find('@'); - while (pos != std::string::npos) + while (position != std::string::npos) { - mSpeech.erase(pos, 2); - pos = mSpeech.find('@'); + mSpeech.erase(position, 2); + position = mSpeech.find('@'); } - - pos = mSpeech.find('|'); - - if (pos != std::string::npos) - mSpeech = mSpeech.substr(pos + 1, mSpeech.size()); } if (mSpeech != "") -- cgit v1.2.3-70-g09d2