diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-20 18:05:26 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-20 18:05:26 -0700 |
commit | c6d75d9aad1775e60cc63516e844cf54623a3974 (patch) | |
tree | bc704b0beb8bff0e8579034ab30c69c50dec721e /src/being.cpp | |
parent | 36bd28ec6bfcf1e15fdf4378ce7a5687cad604bd (diff) | |
download | mana-c6d75d9aad1775e60cc63516e844cf54623a3974.tar.gz mana-c6d75d9aad1775e60cc63516e844cf54623a3974.tar.bz2 mana-c6d75d9aad1775e60cc63516e844cf54623a3974.tar.xz mana-c6d75d9aad1775e60cc63516e844cf54623a3974.zip |
Added the ability to parse multiple item links, as well as removing
extra spaces before or after the [] tags.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 7643c91b..c5a98a2d 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -182,10 +182,10 @@ void Being::setSpeech(const std::string &text, Uint32 time) } // check for links - const std::string::size_type start = mSpeech.find('['); - const std::string::size_type end = mSpeech.find(']', start); + std::string::size_type start = mSpeech.find('['); + std::string::size_type end = mSpeech.find(']', start); - if (start != std::string::npos && end != std::string::npos) + while (start != std::string::npos && end != std::string::npos) { std::string::size_type position = mSpeech.find('|'); mSpeech.erase(end, 1); @@ -197,6 +197,9 @@ void Being::setSpeech(const std::string &text, Uint32 time) mSpeech.erase(position, 2); position = mSpeech.find('@'); } + + start = mSpeech.find('[', start + 1); + end = mSpeech.find(']', start); } if (mSpeech != "") |