diff options
author | Rogier <rogier777@gmail.com> | 2016-12-11 18:47:50 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-08-12 19:14:07 +0200 |
commit | a067d404542704c3bcc284262f588fba398b3102 (patch) | |
tree | b390a54cacdb4131a55ed2b1332acb556aa43c66 /src/staticobject.cpp | |
parent | 33fdd48a763f2a0040a363958f1ca7a0d4f47ba4 (diff) | |
download | minetest-a067d404542704c3bcc284262f588fba398b3102.tar.gz minetest-a067d404542704c3bcc284262f588fba398b3102.tar.bz2 minetest-a067d404542704c3bcc284262f588fba398b3102.zip |
Handle multiple deserialization of a block's entities
This fix consists of two parts:
- Clear the list of stored entities. This has no side-effects.
- Catch the case where active entities exist and print a message.
Clearing the active entitiy list has side-effects that should
be handled. (those entities are known to the environment and
to clients).
As avoiding those side-effects is more complex, and as this
problem is not expected to occur (with PR #4847 merged), there
is no real incentive to implement this ATM.
This issue was a contributing factor to bug #4217. With the other
contributing factor removed (PR #4847), this commit makes sure this
factor does not go unnoticed if it ever happens again.
Diffstat (limited to 'src/staticobject.cpp')
-rw-r--r-- | src/staticobject.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/staticobject.cpp b/src/staticobject.cpp index b331ac2f2..bebca12ec 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -77,6 +77,15 @@ void StaticObjectList::serialize(std::ostream &os) } void StaticObjectList::deSerialize(std::istream &is) { + if (m_active.size()) { + errorstream << "StaticObjectList::deSerialize(): " + << "deserializing objects while " << m_active.size() + << " active objects already exist (not cleared). " + << m_stored.size() << " stored objects _were_ cleared" + << std::endl; + } + m_stored.clear(); + // version u8 version = readU8(is); // count |