1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

(se)SerializeString: Include max length in the name

This commit clarifies the maximal length of the serialized strings.
It will avoid accidental use of serializeString() when a larger string can be expected.

Removes unused Wide String serialization functions
This commit is contained in:
SmallJoker 2020-09-20 13:12:55 +02:00 committed by Loïc Blot
parent ca5c2dbefa
commit 947466ab28
23 changed files with 168 additions and 223 deletions

View file

@ -242,7 +242,7 @@ std::string UnitSAO::generateUpdateAttachmentCommand() const
writeU8(os, AO_CMD_ATTACH_TO);
// parameters
writeS16(os, m_attachment_parent_id);
os << serializeString(m_attachment_bone);
os << serializeString16(m_attachment_bone);
writeV3F32(os, m_attachment_position);
writeV3F32(os, m_attachment_rotation);
return os.str();
@ -255,7 +255,7 @@ std::string UnitSAO::generateUpdateBonePositionCommand(
// command
writeU8(os, AO_CMD_SET_BONE_POSITION);
// parameters
os << serializeString(bone);
os << serializeString16(bone);
writeV3F32(os, position);
writeV3F32(os, rotation);
return os.str();
@ -291,7 +291,7 @@ std::string UnitSAO::generateUpdateArmorGroupsCommand() const
writeU8(os, AO_CMD_UPDATE_ARMOR_GROUPS);
writeU16(os, m_armor_groups.size());
for (const auto &armor_group : m_armor_groups) {
os << serializeString(armor_group.first);
os << serializeString16(armor_group.first);
writeS16(os, armor_group.second);
}
return os.str();