summaryrefslogtreecommitdiffstats
path: root/src/Map.h
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-13 16:13:09 +0100
committerandrew <xdotftw@gmail.com>2014-02-13 16:13:09 +0100
commit92e85cc96030285bba74837759925866c1be7235 (patch)
treeaf478bb840eefb7164860cddee745acf5e598bd9 /src/Map.h
parentUpdated COMPILING instructions for out-of-source build. (diff)
downloadcuberite-92e85cc96030285bba74837759925866c1be7235.tar
cuberite-92e85cc96030285bba74837759925866c1be7235.tar.gz
cuberite-92e85cc96030285bba74837759925866c1be7235.tar.bz2
cuberite-92e85cc96030285bba74837759925866c1be7235.tar.lz
cuberite-92e85cc96030285bba74837759925866c1be7235.tar.xz
cuberite-92e85cc96030285bba74837759925866c1be7235.tar.zst
cuberite-92e85cc96030285bba74837759925866c1be7235.zip
Diffstat (limited to '')
-rw-r--r--src/Map.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/Map.h b/src/Map.h
new file mode 100644
index 000000000..80bbd4ab4
--- /dev/null
+++ b/src/Map.h
@@ -0,0 +1,95 @@
+
+// Map.h
+
+// Implementation of in-game coloured maps
+
+
+
+
+
+#pragma once
+
+
+
+
+
+#include "BlockID.h"
+
+
+
+
+
+class cClientHandle;
+class cWorld;
+
+
+
+
+
+class cMap
+{
+public:
+
+ typedef Byte ColorID;
+
+ typedef std::vector<ColorID> cColorList;
+
+
+public:
+
+ cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale = 3);
+
+ /** Update the map (Query the world) */
+ void UpdateMap(void);
+
+ /** Send this map to the specified client. */
+ void SendTo(cClientHandle & a_Client);
+
+ void Resize(unsigned int a_Width, unsigned int a_Height);
+
+ void SetPosition(int a_CenterX, int a_CenterZ);
+
+ void SetScale(unsigned int a_Scale);
+
+ unsigned int GetWidth (void) const { return m_Width; }
+ unsigned int GetHeight(void) const { return m_Height; }
+
+ unsigned int GetScale(void) const { return m_Scale; }
+
+ int GetCenterX(void) const { return m_CenterX; }
+ int GetCenterZ(void) const { return m_CenterZ; }
+
+ unsigned int GetID(void) const { return m_ID; }
+
+ cWorld * GetWorld(void) { return m_World; }
+
+ eDimension GetDimension(void) const;
+
+ const cColorList & GetData(void) const { return m_Data; }
+
+ unsigned int GetNumPixels(void) const;
+
+ unsigned int GetNumBlocksPerPixel(void) const;
+
+
+private:
+
+ unsigned int m_ID;
+
+ unsigned int m_Width;
+ unsigned int m_Height;
+
+ /** The zoom level, 2^scale square blocks per pixel */
+ unsigned int m_Scale;
+
+ int m_CenterX;
+ int m_CenterZ;
+
+ /** Column-major array of colours */
+ cColorList m_Data;
+
+ cWorld * m_World;
+
+ friend class cMapSerializer;
+
+};