Os emoji in lobby (#4298)

* first version, not work with old version server

* fix bug of sending extra byte

* delete the extra line
This commit is contained in:
riso 2020-05-24 10:56:25 -05:00 committed by GitHub
parent f316a83c63
commit b22c09e345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3807,10 +3807,24 @@ void ServerLobby::updatePlayerList(bool update_when_reset_server)
.addUInt8((uint8_t)(game_started ? 1 : 0))
.addUInt8((uint8_t)all_profiles.size());
for (auto profile : all_profiles)
{
// get OS information
auto version_os = StringUtils::extractVersionOS(profile->getPeer()->getUserVersion());
std::string os_type_str = version_os.second;
// if mobile OS
if (os_type_str == "iOS" || os_type_str == "Android")
{ // Add a Mobile emoji for mobile OS
pl->addUInt32(profile->getHostId()).addUInt32(profile->getOnlineId())
.addUInt8(profile->getLocalPlayerId())
.encodeString(StringUtils::utf32ToWide({0x1F4F1}) + profile->getName());
}
else
{
pl->addUInt32(profile->getHostId()).addUInt32(profile->getOnlineId())
.addUInt8(profile->getLocalPlayerId())
.encodeString(profile->getName());
}
std::shared_ptr<STKPeer> p = profile->getPeer();
uint8_t boolean_combine = 0;
if (p && p->isWaitingForGame())