mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
use UTF8ToUTF16 more (#695)
This commit is contained in:
@@ -978,6 +978,8 @@ void GameMessages::SendSetNetworkScriptVar(Entity* entity, const SystemAddress&
|
||||
bitStream.Write(entity->GetObjectID());
|
||||
bitStream.Write((uint16_t)GAME_MSG_SET_NETWORK_SCRIPT_VAR);
|
||||
|
||||
// FIXME: this is a bad place to need to do a conversion because we have no clue whether data is utf8 or plain ascii
|
||||
// an this has performance implications
|
||||
const auto u16Data = GeneralUtils::ASCIIToUTF16(data);
|
||||
uint32_t dataSize = static_cast<uint32_t>(u16Data.size());
|
||||
|
||||
@@ -3188,7 +3190,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity*
|
||||
i64Invitee,
|
||||
bNeedInvitePopUp,
|
||||
entity->GetObjectID(),
|
||||
GeneralUtils::ASCIIToUTF16(entity->GetCharacter()->GetName()),
|
||||
GeneralUtils::UTF8ToUTF16(entity->GetCharacter()->GetName()),
|
||||
invitee->GetSystemAddress()
|
||||
);
|
||||
}
|
||||
@@ -5086,7 +5088,8 @@ void GameMessages::HandleNotifyServerLevelProcessingComplete(RakNet::BitStream*
|
||||
wss << "name=0:";
|
||||
wss << character->GetName();
|
||||
|
||||
std::u16string attrs = GeneralUtils::ASCIIToUTF16(wss.str());
|
||||
// FIXME: only really need utf8 conversion for the name, so move that up?
|
||||
std::u16string attrs = GeneralUtils::UTF8ToUTF16(wss.str());
|
||||
std::u16string wsText = u"UI_LEVEL_PROGRESSION_LEVELUP_MESSAGE";
|
||||
|
||||
GameMessages::SendBroadcastTextToChatbox(entity, UNASSIGNED_SYSTEM_ADDRESS, attrs, wsText);
|
||||
|
@@ -14,19 +14,19 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con
|
||||
stream.Write<uint16_t>(VendorMapId); // - vendor map id
|
||||
stream.Write<uint32_t>(cloneId); // clone id
|
||||
|
||||
const auto& name = GeneralUtils::ASCIIToUTF16(Name);
|
||||
const auto& name = GeneralUtils::UTF8ToUTF16(Name);
|
||||
stream.Write(uint32_t(name.size()));
|
||||
for (uint32_t i = 0; i < name.size(); ++i) {
|
||||
stream.Write(uint16_t(name[i]));
|
||||
}
|
||||
|
||||
const auto& description = GeneralUtils::ASCIIToUTF16(Description);
|
||||
const auto& description = GeneralUtils::UTF8ToUTF16(Description);
|
||||
stream.Write(uint32_t(description.size()));
|
||||
for (uint32_t i = 0; i < description.size(); ++i) {
|
||||
stream.Write(uint16_t(description[i]));
|
||||
}
|
||||
|
||||
const auto& owner = GeneralUtils::ASCIIToUTF16(OwnerName);
|
||||
const auto& owner = GeneralUtils::UTF8ToUTF16(OwnerName);
|
||||
stream.Write(uint32_t(owner.size()));
|
||||
for (uint32_t i = 0; i < owner.size(); ++i) {
|
||||
stream.Write(uint16_t(owner[i]));
|
||||
@@ -68,7 +68,7 @@ void GameMessages::PropertyDataMessage::Serialize(RakNet::BitStream& stream) con
|
||||
else stream.Write<uint32_t>(REJECTION_STATUS_PENDING);
|
||||
|
||||
// Does this go here???
|
||||
// const auto& rejectionReasonConverted = GeneralUtils::ASCIIToUTF16(rejectionReason);
|
||||
// const auto& rejectionReasonConverted = GeneralUtils::UTF8ToUTF16(rejectionReason);
|
||||
// stream.Write(uint32_t(rejectionReasonConverted.size()));
|
||||
// for (uint32_t i = 0; i < rejectionReasonConverted.size(); ++i) {
|
||||
// stream.Write(uint16_t(rejectionReasonConverted[i]));
|
||||
|
@@ -3,19 +3,19 @@
|
||||
void PropertySelectQueryProperty::Serialize(RakNet::BitStream& stream) const {
|
||||
stream.Write(CloneId);
|
||||
|
||||
const auto& owner = GeneralUtils::ASCIIToUTF16(OwnerName);
|
||||
const auto& owner = GeneralUtils::UTF8ToUTF16(OwnerName);
|
||||
stream.Write(uint32_t(owner.size()));
|
||||
for (uint32_t i = 0; i < owner.size(); ++i) {
|
||||
stream.Write(static_cast<uint16_t>(owner[i]));
|
||||
}
|
||||
|
||||
const auto& name = GeneralUtils::ASCIIToUTF16(Name);
|
||||
const auto& name = GeneralUtils::UTF8ToUTF16(Name);
|
||||
stream.Write(uint32_t(name.size()));
|
||||
for (uint32_t i = 0; i < name.size(); ++i) {
|
||||
stream.Write(static_cast<uint16_t>(name[i]));
|
||||
}
|
||||
|
||||
const auto& description = GeneralUtils::ASCIIToUTF16(Description);
|
||||
const auto& description = GeneralUtils::UTF8ToUTF16(Description);
|
||||
stream.Write(uint32_t(description.size()));
|
||||
for (uint32_t i = 0; i < description.size(); ++i) {
|
||||
stream.Write(static_cast<uint16_t>(description[i]));
|
||||
|
Reference in New Issue
Block a user