aboutsummaryrefslogtreecommitdiff
path: root/src/itemdef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r--src/itemdef.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index 8e0492827..df20bdf15 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -128,10 +128,10 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
u8 version = 6;
writeU8(os, version);
writeU8(os, type);
- os << serializeString(name);
- os << serializeString(description);
- os << serializeString(inventory_image);
- os << serializeString(wield_image);
+ os << serializeString16(name);
+ os << serializeString16(description);
+ os << serializeString16(inventory_image);
+ os << serializeString16(wield_image);
writeV3F32(os, wield_scale);
writeS16(os, stack_max);
writeU8(os, usable);
@@ -143,25 +143,25 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
tool_capabilities->serialize(tmp_os, protocol_version);
tool_capabilities_s = tmp_os.str();
}
- os << serializeString(tool_capabilities_s);
+ os << serializeString16(tool_capabilities_s);
writeU16(os, groups.size());
for (const auto &group : groups) {
- os << serializeString(group.first);
+ os << serializeString16(group.first);
writeS16(os, group.second);
}
- os << serializeString(node_placement_prediction);
+ os << serializeString16(node_placement_prediction);
// Version from ContentFeatures::serialize to keep in sync
sound_place.serialize(os, CONTENTFEATURES_VERSION);
sound_place_failed.serialize(os, CONTENTFEATURES_VERSION);
writeF32(os, range);
- os << serializeString(palette_image);
+ os << serializeString16(palette_image);
writeARGB8(os, color);
- os << serializeString(inventory_overlay);
- os << serializeString(wield_overlay);
+ os << serializeString16(inventory_overlay);
+ os << serializeString16(wield_overlay);
}
void ItemDefinition::deSerialize(std::istream &is)
@@ -175,16 +175,16 @@ void ItemDefinition::deSerialize(std::istream &is)
throw SerializationError("unsupported ItemDefinition version");
type = (enum ItemType)readU8(is);
- name = deSerializeString(is);
- description = deSerializeString(is);
- inventory_image = deSerializeString(is);
- wield_image = deSerializeString(is);
+ name = deSerializeString16(is);
+ description = deSerializeString16(is);
+ inventory_image = deSerializeString16(is);
+ wield_image = deSerializeString16(is);
wield_scale = readV3F32(is);
stack_max = readS16(is);
usable = readU8(is);
liquids_pointable = readU8(is);
- std::string tool_capabilities_s = deSerializeString(is);
+ std::string tool_capabilities_s = deSerializeString16(is);
if (!tool_capabilities_s.empty()) {
std::istringstream tmp_is(tool_capabilities_s, std::ios::binary);
tool_capabilities = new ToolCapabilities;
@@ -194,22 +194,22 @@ void ItemDefinition::deSerialize(std::istream &is)
groups.clear();
u32 groups_size = readU16(is);
for(u32 i=0; i<groups_size; i++){
- std::string name = deSerializeString(is);
+ std::string name = deSerializeString16(is);
int value = readS16(is);
groups[name] = value;
}
- node_placement_prediction = deSerializeString(is);
+ node_placement_prediction = deSerializeString16(is);
// Version from ContentFeatures::serialize to keep in sync
sound_place.deSerialize(is, CONTENTFEATURES_VERSION);
sound_place_failed.deSerialize(is, CONTENTFEATURES_VERSION);
range = readF32(is);
- palette_image = deSerializeString(is);
+ palette_image = deSerializeString16(is);
color = readARGB8(is);
- inventory_overlay = deSerializeString(is);
- wield_overlay = deSerializeString(is);
+ inventory_overlay = deSerializeString16(is);
+ wield_overlay = deSerializeString16(is);
// If you add anything here, insert it primarily inside the try-catch
// block to not need to increase the version.
@@ -521,14 +521,14 @@ public:
// Serialize ItemDefinition and write wrapped in a string
std::ostringstream tmp_os(std::ios::binary);
def->serialize(tmp_os, protocol_version);
- os << serializeString(tmp_os.str());
+ os << serializeString16(tmp_os.str());
}
writeU16(os, m_aliases.size());
for (const auto &it : m_aliases) {
- os << serializeString(it.first);
- os << serializeString(it.second);
+ os << serializeString16(it.first);
+ os << serializeString16(it.second);
}
}
void deSerialize(std::istream &is)
@@ -543,7 +543,7 @@ public:
for(u16 i=0; i<count; i++)
{
// Deserialize a string and grab an ItemDefinition from it
- std::istringstream tmp_is(deSerializeString(is), std::ios::binary);
+ std::istringstream tmp_is(deSerializeString16(is), std::ios::binary);
ItemDefinition def;
def.deSerialize(tmp_is);
// Register
@@ -552,8 +552,8 @@ public:
u16 num_aliases = readU16(is);
for(u16 i=0; i<num_aliases; i++)
{
- std::string name = deSerializeString(is);
- std::string convert_to = deSerializeString(is);
+ std::string name = deSerializeString16(is);
+ std::string convert_to = deSerializeString16(is);
registerAlias(name, convert_to);
}
}