diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2021-09-10 17:16:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 23:16:34 +0200 |
commit | 7423c4c11e01edecd8db18b147bab4d2f3eeb471 (patch) | |
tree | f350bf6384750fb5a27995e9db59298a7628f99b | |
parent | 2cefe51d3b9bc4f3ae18854e171a06ea83e9cb25 (diff) | |
download | minetest-7423c4c11e01edecd8db18b147bab4d2f3eeb471.tar.gz minetest-7423c4c11e01edecd8db18b147bab4d2f3eeb471.tar.bz2 minetest-7423c4c11e01edecd8db18b147bab4d2f3eeb471.zip |
Send to clients node metadata that changed to become empty (#11597)
-rw-r--r-- | src/nodemetadata.cpp | 6 | ||||
-rw-r--r-- | src/nodemetadata.h | 2 | ||||
-rw-r--r-- | src/server.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/nodemetadata.cpp b/src/nodemetadata.cpp index f98732385..b5052c3b8 100644 --- a/src/nodemetadata.cpp +++ b/src/nodemetadata.cpp @@ -113,13 +113,13 @@ int NodeMetadata::countNonPrivate() const */ void NodeMetadataList::serialize(std::ostream &os, u8 blockver, bool disk, - bool absolute_pos) const + bool absolute_pos, bool include_empty) const { /* Version 0 is a placeholder for "nothing to see here; go away." */ - u16 count = countNonEmpty(); + u16 count = include_empty ? m_data.size() : countNonEmpty(); if (count == 0) { writeU8(os, 0); // version return; @@ -134,7 +134,7 @@ void NodeMetadataList::serialize(std::ostream &os, u8 blockver, bool disk, i != m_data.end(); ++i) { v3s16 p = i->first; NodeMetadata *data = i->second; - if (data->empty()) + if (!include_empty && data->empty()) continue; if (absolute_pos) { diff --git a/src/nodemetadata.h b/src/nodemetadata.h index c028caf88..4b5b4d887 100644 --- a/src/nodemetadata.h +++ b/src/nodemetadata.h @@ -82,7 +82,7 @@ public: ~NodeMetadataList(); void serialize(std::ostream &os, u8 blockver, bool disk = true, - bool absolute_pos = false) const; + bool absolute_pos = false, bool include_empty = false) const; void deSerialize(std::istream &is, IItemDefManager *item_def_mgr, bool absolute_pos = false); diff --git a/src/server.cpp b/src/server.cpp index 1b5cbe395..46b497d6e 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2320,7 +2320,7 @@ void Server::sendMetadataChanged(const std::list<v3s16> &meta_updates, float far // Send the meta changes std::ostringstream os(std::ios::binary); - meta_updates_list.serialize(os, client->net_proto_version, false, true); + meta_updates_list.serialize(os, client->serialization_version, false, true, true); std::ostringstream oss(std::ios::binary); compressZlib(os.str(), oss); |