diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-29 08:55:59 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-29 08:55:59 -0700 |
commit | 68f3b73a82999b8ee8c7937b9da8060af1f3b691 (patch) | |
tree | 41ccc60db4cf97c0f77beabe1459a2e0d3749e62 /src | |
parent | 0a2883b61472c5dbcd419d033bd8792c335dc175 (diff) | |
download | mana-68f3b73a82999b8ee8c7937b9da8060af1f3b691.tar.gz mana-68f3b73a82999b8ee8c7937b9da8060af1f3b691.tar.bz2 mana-68f3b73a82999b8ee8c7937b9da8060af1f3b691.tar.xz mana-68f3b73a82999b8ee8c7937b9da8060af1f3b691.zip |
If an item link isn't found, don't treat it as a link.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 3 | ||||
-rw-r--r-- | src/gui/chat.cpp | 20 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/being.cpp b/src/being.cpp index 9de03502..e2495bc0 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -193,7 +193,8 @@ void Being::setSpeech(const std::string &text, Uint32 time) } std::string::size_type position = mSpeech.find('|'); - mSpeech.erase(end, 1); + if (mSpeech[start + 1] == '@' && mSpeech[start + 2] == '@') + mSpeech.erase(end, 1); mSpeech.erase(start, (position - start) + 1); position = mSpeech.find('@'); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 068fad08..d790d292 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -376,14 +376,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) std::string temp = msg.substr(start+1, end - start - 1); - while (temp[0] == ' ') - { - temp = temp.substr(1, temp.size()); - } - while (temp[temp.size()] == ' ') - { - temp = temp.substr(0, temp.size() - 1); - } + trim(temp); for (unsigned int i = 0; i < temp.size(); i++) { @@ -391,10 +384,13 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } const ItemInfo itemInfo = ItemDB::get(temp); - msg.insert(end, "@@"); - msg.insert(start+1, "|"); - msg.insert(start+1, toString(itemInfo.getId())); - msg.insert(start+1, "@@"); + if (itemInfo.getName() != _("Unknown item")) + { + msg.insert(end, "@@"); + msg.insert(start+1, "|"); + msg.insert(start+1, toString(itemInfo.getId())); + msg.insert(start+1, "@@"); + } } start = msg.find('[', start + 1); } |