summaryrefslogtreecommitdiff
path: root/src/nodemetadata.h
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2017-05-10 15:29:21 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-05-10 15:29:21 +0200
commit071e114ffa945522a7a9acc3259427166992d5ee (patch)
treeb76be5cdc27e9a8d9b58ff15f80691e012afa702 /src/nodemetadata.h
parent6945f807abd789e0f522351e5e790ff2afced233 (diff)
downloadminetest-071e114ffa945522a7a9acc3259427166992d5ee.tar.gz
minetest-071e114ffa945522a7a9acc3259427166992d5ee.tar.bz2
minetest-071e114ffa945522a7a9acc3259427166992d5ee.zip
Private nodemeta (#5702)
* Private node metadata that isn't sent to the client
Diffstat (limited to 'src/nodemetadata.h')
-rw-r--r--src/nodemetadata.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nodemetadata.h b/src/nodemetadata.h
index f46c0fe91..0d72485bc 100644
--- a/src/nodemetadata.h
+++ b/src/nodemetadata.h
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define NODEMETADATA_HEADER
#include "metadata.h"
+#include "util/cpp11_container.h"
/*
NodeMetadata stores arbitary amounts of data for special blocks.
@@ -40,8 +41,8 @@ public:
NodeMetadata(IItemDefManager *item_def_mgr);
~NodeMetadata();
- void serialize(std::ostream &os) const;
- void deSerialize(std::istream &is);
+ void serialize(std::ostream &os, u8 version, bool disk=true) const;
+ void deSerialize(std::istream &is, u8 version);
void clear();
bool empty() const;
@@ -52,8 +53,17 @@ public:
return m_inventory;
}
+ inline bool isPrivate(const std::string &name) const
+ {
+ return m_privatevars.count(name) != 0;
+ }
+ void markPrivate(const std::string &name, bool set);
+
private:
+ int countNonPrivate() const;
+
Inventory *m_inventory;
+ UNORDERED_SET<std::string> m_privatevars;
};
@@ -66,7 +76,7 @@ class NodeMetadataList
public:
~NodeMetadataList();
- void serialize(std::ostream &os) const;
+ void serialize(std::ostream &os, u8 blockver, bool disk=true) const;
void deSerialize(std::istream &is, IItemDefManager *item_def_mgr);
// Add all keys in this list to the vector keys