diff options
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); } |