NetPlay: Limit nickname length

Ridiculously long nicknames cause UI silliness, so 30 characters seems
like a reasonable limit, as it's the same as the forum.
This commit is contained in:
Techjar
2018-11-21 00:15:44 -05:00
parent 92812d0b0b
commit 037aa2192f
6 changed files with 24 additions and 4 deletions

View File

@ -412,6 +412,12 @@ void StringPopBackIf(std::string* s, char c)
s->pop_back();
}
size_t StringUTF8CodePointCount(const std::string& str)
{
return str.size() -
std::count_if(str.begin(), str.end(), [](char c) -> bool { return (c & 0xC0) == 0x80; });
}
#ifdef _WIN32
std::wstring CPToUTF16(u32 code_page, std::string_view input)