1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Add a short_description to be used by mods (#8980)

This commit is contained in:
DS 2020-10-09 20:11:21 +02:00 committed by GitHub
parent b2f3f66385
commit f3ae45b2b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 102 additions and 2 deletions

View file

@ -62,6 +62,7 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
type = def.type;
name = def.name;
description = def.description;
short_description = def.short_description;
inventory_image = def.inventory_image;
inventory_overlay = def.inventory_overlay;
wield_image = def.wield_image;
@ -102,6 +103,7 @@ void ItemDefinition::reset()
type = ITEM_NONE;
name = "";
description = "";
short_description = "";
inventory_image = "";
inventory_overlay = "";
wield_image = "";
@ -162,6 +164,8 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
writeARGB8(os, color);
os << serializeString16(inventory_overlay);
os << serializeString16(wield_overlay);
os << serializeString16(short_description);
}
void ItemDefinition::deSerialize(std::istream &is)
@ -213,8 +217,9 @@ void ItemDefinition::deSerialize(std::istream &is)
// If you add anything here, insert it primarily inside the try-catch
// block to not need to increase the version.
//try {
//} catch(SerializationError &e) {};
try {
short_description = deSerializeString16(is);
} catch(SerializationError &e) {};
}