summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp17
1 files changed, 7 insertions, 10 deletions
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 != "")