summaryrefslogtreecommitdiff
path: root/src/util/areastore.h
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-10-30 19:27:48 -0400
committerShadowNinja <shadowninja@minetest.net>2016-03-07 16:33:20 -0500
commit821551a2669123ac9a476894d65b5efe10026040 (patch)
tree33fcfe3b0c6182a2084fa9957d4eb602483f4f44 /src/util/areastore.h
parentc4b7afed7ed12f8d5894c1a5dd15ea376af06da6 (diff)
downloadminetest-821551a2669123ac9a476894d65b5efe10026040.tar.gz
minetest-821551a2669123ac9a476894d65b5efe10026040.tar.bz2
minetest-821551a2669123ac9a476894d65b5efe10026040.zip
Implement AreaStore serialization
Diffstat (limited to 'src/util/areastore.h')
-rw-r--r--src/util/areastore.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/util/areastore.h b/src/util/areastore.h
index 5b4e9a71f..ab6bd76a3 100644
--- a/src/util/areastore.h
+++ b/src/util/areastore.h
@@ -92,16 +92,14 @@ public:
/// or NULL if it doesn't exist.
const Area *getArea(u32 id) const;
-#if 0
- typedef bool (*ForEachCallback)(const Area *a, void *arg);
- /// Calls a passed function for every stored area, until the
- /// callback returns true. If that happens, it returns true,
- /// if the search is exhausted, it returns false.
- virtual bool forEach(ForEachCallback, void *arg=NULL) const = 0;
-
+ /// Serializes the store's areas to a binary ostream.
void serialize(std::ostream &is) const;
- bool deserialize(std::istream &is);
-#endif
+
+ /// Deserializes the Areas from a binary istream.
+ /// This does not currently clear the AreaStore before adding the
+ /// areas, making it possible to deserialize multiple serialized
+ /// AreaStores.
+ void deserialize(std::istream &is);
protected:
/// Invalidates the getAreasForPos cache.
@@ -141,7 +139,6 @@ public:
virtual bool removeArea(u32 id);
virtual void getAreasInArea(std::vector<Area *> *result,
v3s16 minedge, v3s16 maxedge, bool accept_overlap);
- //virtual bool forEach(ForEachCallback, void *arg) const;
protected:
virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos);
@@ -162,7 +159,6 @@ public:
virtual bool removeArea(u32 id);
virtual void getAreasInArea(std::vector<Area *> *result,
v3s16 minedge, v3s16 maxedge, bool accept_overlap);
- //virtual bool forEach(ForEachCallback, void *arg) const;
protected:
virtual void getAreasForPosImpl(std::vector<Area *> *result, v3s16 pos);