summaryrefslogtreecommitdiff
path: root/src/object_properties.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2017-09-15 12:18:47 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-09-15 12:18:47 +0200
commitedbc533414b0ba991a82f8003d90924e1dc60d95 (patch)
tree9fe4c04bc35f345e9a62f1358fa5e0ad324938e9 /src/object_properties.cpp
parent7640749d68b87a62868840d34a665101861ca9c0 (diff)
downloadminetest-edbc533414b0ba991a82f8003d90924e1dc60d95.tar.gz
minetest-edbc533414b0ba991a82f8003d90924e1dc60d95.tar.bz2
minetest-edbc533414b0ba991a82f8003d90924e1dc60d95.zip
Customizeable max breath for players (#6411)
* Customizeable maximal breath for players
Diffstat (limited to 'src/object_properties.cpp')
-rw-r--r--src/object_properties.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/object_properties.cpp b/src/object_properties.cpp
index 4171317de..9cbaadc64 100644
--- a/src/object_properties.cpp
+++ b/src/object_properties.cpp
@@ -34,6 +34,7 @@ std::string ObjectProperties::dump()
{
std::ostringstream os(std::ios::binary);
os << "hp_max=" << hp_max;
+ os << ", breath_max=" << breath_max;
os << ", physical=" << physical;
os << ", collideWithObjects=" << collideWithObjects;
os << ", weight=" << weight;
@@ -108,6 +109,7 @@ void ObjectProperties::serialize(std::ostream &os) const
os << serializeString(wield_item);
writeU8(os, can_zoom);
writeS8(os, glow);
+ writeU16(os, breath_max);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
@@ -155,5 +157,9 @@ void ObjectProperties::deSerialize(std::istream &is)
infotext = deSerializeString(is);
wield_item = deSerializeString(is);
can_zoom = readU8(is);
- glow = readS8(is);
+
+ try {
+ glow = readS8(is);
+ breath_max = readU16(is);
+ } catch (SerializationError &e) {}
}