diff --git a/Minecraft.Client/ChatScreen.cpp b/Minecraft.Client/ChatScreen.cpp index dc62d0c43..fffa1562f 100644 --- a/Minecraft.Client/ChatScreen.cpp +++ b/Minecraft.Client/ChatScreen.cpp @@ -17,29 +17,6 @@ bool ChatScreen::isAllowedChatChar(wchar_t c) return c >= 0x20 && (c == L'\u00A7' || allowedChars.empty() || allowedChars.find(c) != wstring::npos); } -int VisibleCharLength(wstring message) { - static std::unordered_set validStyleCharacters = { - L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', - L'a', L'b', L'c', L'd', L'e', L'f', - }; - int results = 0; - - - for (int i = 0; i < message.size(); i++) { - wchar_t _char = message[i]; - if (_char == L'§' && (i + 1) < message.size()) { - wchar_t colorChar = message[i + 1]; - if (validStyleCharacters.find(colorChar) != validStyleCharacters.end()) { - i++; //do this so it increments 2 instead of 1 - continue; - } - } - results++; - } - - return results; -} - ChatScreen::ChatScreen() { frame = 0; @@ -154,7 +131,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) cursorIndex--; return; } - if (isAllowedChatChar(ch) && VisibleCharLength(message) < SharedConstants::maxVisibleLength) + if (isAllowedChatChar(ch) && static_cast(message.length()) < SharedConstants::maxVisibleLength) { message.insert(cursorIndex, 1, ch); cursorIndex++;