diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-10 05:25:49 -0600 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-10 07:32:14 -0600 |
commit | 0fb4dc37c61341a237bab30896bd2c457222ed03 (patch) | |
tree | 49fd91de526dc47eb3f85d20aeb33fb1951888d4 /src/gui/chat.cpp | |
parent | 3f322e9eec45751686c59ec89bee46d1da34c885 (diff) | |
download | mana-0fb4dc37c61341a237bab30896bd2c457222ed03.tar.gz mana-0fb4dc37c61341a237bab30896bd2c457222ed03.tar.bz2 mana-0fb4dc37c61341a237bab30896bd2c457222ed03.tar.xz mana-0fb4dc37c61341a237bab30896bd2c457222ed03.zip |
Fix typo in item link parsing
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index fd2b05e4..5cf8b739 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -222,34 +222,39 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) << "] "; // Check for item link - std::string::size_type start = msg.find('['); - while (start != std::string::npos && msg[start+1] != '@') + std::string::size_type start = tmp.text.find('['); + while (start != std::string::npos && tmp.text[start+1] != '@') { - std::string::size_type end = msg.find(']', start); + std::string::size_type end = tmp.text.find(']', start); if (start+1 != end && end != std::string::npos) { // Catch multiple embeds and ignore them // so it doesn't crash the client. - while ((msg.find('[', start + 1) != std::string::npos) && - (msg.find('[', start + 1) < end)) + while ((tmp.text.find('[', start + 1) != std::string::npos) && + (tmp.text.find('[', start + 1) < end)) { - start = msg.find('[', start + 1); + start = tmp.text.find('[', start + 1); } - std::string temp = msg.substr(start + 1, end - start - 1); + std::string temp = tmp.text.substr(start+1, end - start - 1); - toLower(trim(temp)); + trim(temp); + + for (unsigned int i = 0; i < temp.size(); i++) + { + temp[i] = (char) tolower(temp[i]); + } const ItemInfo itemInfo = ItemDB::get(temp); if (itemInfo.getName() != _("Unknown item")) { - msg.insert(end, "@@"); - msg.insert(start+1, "|"); - msg.insert(start+1, toString(itemInfo.getId())); - msg.insert(start+1, "@@"); + tmp.text.insert(end, "@@"); + tmp.text.insert(start+1, "|"); + tmp.text.insert(start+1, toString(itemInfo.getId())); + tmp.text.insert(start+1, "@@"); } } - start = msg.find('[', start + 1); + start = tmp.text.find('[', start + 1); } line = lineColor + timeStr.str() + tmp.nick + tmp.text; |