summaryrefslogtreecommitdiffstats
path: root/src/Map.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-14 15:21:16 +0100
committerandrew <xdotftw@gmail.com>2014-02-14 15:21:16 +0100
commit5b92b877bcc0c5072dbea98b6c54106f954aa758 (patch)
treefa91320608d925cac74804fd44597198e2f3760e /src/Map.cpp
parentIDCount Serialization (diff)
downloadcuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.gz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.bz2
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.lz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.xz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.zst
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.zip
Diffstat (limited to 'src/Map.cpp')
-rw-r--r--src/Map.cpp47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/Map.cpp b/src/Map.cpp
index f99b01752..4acd9512c 100644
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -7,6 +7,7 @@
#include "ClientHandle.h"
#include "World.h"
+#include "Chunk.h"
@@ -22,8 +23,6 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World)
, m_World(a_World)
{
m_Data.assign(m_Width * m_Height, 0);
-
- // Do not update map
}
@@ -41,27 +40,45 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un
{
m_Data.assign(m_Width * m_Height, 0);
- UpdateMap();
+ for (unsigned int X = 0; X < m_Width; ++X)
+ {
+ for (unsigned int Y = 0; Y < m_Height; ++Y)
+ {
+ // Debug
+ m_Data[Y + X * m_Height] = rand() % 100;
+ }
+ }
}
-void cMap::UpdateMap(void)
+bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y)
{
- // ASSERT(m_World != NULL);
+ ASSERT(m_World != NULL);
- // TODO
+ cChunk * Chunk = NULL;
- for (unsigned int X = 0; X < m_Width; ++X)
+ if (Chunk == NULL)
{
- for (unsigned int Y = 0; Y < m_Height; ++Y)
- {
- // Debug
- m_Data[Y + X * m_Height] = rand() % 100;
- }
+ return false;
}
+
+ int Height = Chunk->GetHeight(a_X, a_Y);
+
+ // TODO
+
+ return true;
+}
+
+
+
+
+
+void cMap::EraseData(void)
+{
+ m_Data.assign(m_Width * m_Height, 0);
}
@@ -90,8 +107,6 @@ void cMap::Resize(unsigned int a_Width, unsigned int a_Height)
m_Height = a_Height;
m_Data.assign(m_Width * m_Height, 0);
-
- UpdateMap();
}
@@ -107,8 +122,6 @@ void cMap::SetPosition(int a_CenterX, int a_CenterZ)
m_CenterX = a_CenterX;
m_CenterZ = a_CenterZ;
-
- UpdateMap();
}
@@ -123,8 +136,6 @@ void cMap::SetScale(unsigned int a_Scale)
}
m_Scale = a_Scale;
-
- UpdateMap();
}