summaryrefslogtreecommitdiffstats
path: root/src/MapManager.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-24 11:28:34 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-24 11:28:34 +0100
commitf77720c43f22e347ae9e66302a58b5e3f6a6de58 (patch)
tree06bb29a7e50aec777969ead2f5ccdf02393c9e1e /src/MapManager.h
parentRemoved an unused member variable from cChunk. (diff)
parentMaps: Improvements (diff)
downloadcuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar.gz
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar.bz2
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar.lz
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar.xz
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.tar.zst
cuberite-f77720c43f22e347ae9e66302a58b5e3f6a6de58.zip
Diffstat (limited to 'src/MapManager.h')
-rw-r--r--src/MapManager.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/MapManager.h b/src/MapManager.h
new file mode 100644
index 000000000..80e6d16d1
--- /dev/null
+++ b/src/MapManager.h
@@ -0,0 +1,78 @@
+
+// MapManager.h
+
+
+
+
+
+#pragma once
+
+
+
+
+
+#include "Map.h"
+
+
+
+
+typedef cItemCallback<cMap> cMapCallback;
+
+
+
+
+// tolua_begin
+
+/** Manages the in-game maps of a single world - Thread safe. */
+class cMapManager
+{
+public:
+ // tolua_end
+
+ cMapManager(cWorld * a_World);
+
+ /** Returns the map with the specified ID, NULL if out of range.
+ *
+ * WARNING: The returned map object is not thread safe.
+ */
+ cMap * GetMapData(unsigned int a_ID);
+
+ /** Creates a new map. Returns NULL on error */
+ cMap * CreateMap(int a_CenterX, int a_CenterY, int a_Scale = 3);
+
+ /** Calls the callback for the map with the specified ID.
+ *
+ * Returns true if the map was found and the callback called, false if map not found.
+ * Callback return ignored.
+ */
+ bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
+
+ /** Calls the callback for each map.
+ *
+ * Returns true if all maps processed, false if the callback aborted by returning true.
+ */
+ bool ForEachMap(cMapCallback & a_Callback);
+
+ unsigned int GetNumMaps(void) const; // tolua_export
+
+ /** Loads the map data from the disk */
+ void LoadMapData(void);
+
+ /** Saves the map data to the disk */
+ void SaveMapData(void);
+
+
+private:
+
+ typedef std::vector<cMap> cMapList;
+
+ cCriticalSection m_CS;
+
+ cMapList m_MapData;
+
+ cWorld * m_World;
+
+}; // tolua_export
+
+
+