diff options
Diffstat (limited to 'src/itemdef.cpp')
-rw-r--r-- | src/itemdef.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 2971d4e88..60a7dc64e 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -80,6 +80,7 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def) groups = def.groups; node_placement_prediction = def.node_placement_prediction; sound_place = def.sound_place; + sound_place_failed = def.sound_place_failed; range = def.range; return *this; } @@ -114,6 +115,7 @@ void ItemDefinition::reset() } groups.clear(); sound_place = SimpleSoundSpec(); + sound_place_failed = SimpleSoundSpec(); range = -1; node_placement_prediction = ""; @@ -155,8 +157,10 @@ void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const os<<serializeString(sound_place.name); writeF1000(os, sound_place.gain); } - if(protocol_version > 20){ + if (protocol_version > 20) { writeF1000(os, range); + os << serializeString(sound_place_failed.name); + writeF1000(os, sound_place_failed.gain); } } @@ -211,8 +215,10 @@ 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 { + sound_place_failed.name = deSerializeString(is); + sound_place_failed.gain = readF1000(is); + } catch(SerializationError &e) {}; } /* |