From 92e85cc96030285bba74837759925866c1be7235 Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 13 Feb 2014 17:13:09 +0200 Subject: Implementation of in-game maps --- src/Map.cpp | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 src/Map.cpp (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp new file mode 100644 index 000000000..f1b690698 --- /dev/null +++ b/src/Map.cpp @@ -0,0 +1,149 @@ + +// Map.cpp + +#include "Globals.h" + +#include "Map.h" + +#include "ClientHandle.h" +#include "World.h" + + + + + +cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale) + : m_ID(a_ID) + , m_Width(128) + , m_Height(128) + , m_Scale(a_Scale) + , m_CenterX(a_CenterX) + , m_CenterZ(a_CenterZ) + , m_World(a_World) +{ + m_Data.assign(m_Width * m_Height, 0); + + UpdateMap(); +} + + + + + +void cMap::UpdateMap(void) +{ + // ASSERT(m_World != NULL); + + // TODO + + 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; + } + } +} + + + + + +eDimension cMap::GetDimension(void) const +{ + ASSERT(m_World != NULL); + return m_World->GetDimension(); +} + + + + + + +void cMap::Resize(unsigned int a_Width, unsigned int a_Height) +{ + if ((m_Width == a_Width) && (m_Height == a_Height)) + { + return; + } + + m_Width = a_Width; + m_Height = a_Height; + + m_Data.assign(m_Width * m_Height, 0); + + UpdateMap(); +} + + + + + +void cMap::SetPosition(int a_CenterX, int a_CenterZ) +{ + if ((m_CenterX == a_CenterX) && (m_CenterZ == a_CenterZ)) + { + return; + } + + m_CenterX = a_CenterX; + m_CenterZ = a_CenterZ; + + UpdateMap(); +} + + + + + +void cMap::SetScale(unsigned int a_Scale) +{ + if (m_Scale == a_Scale) + { + return; + } + + m_Scale = a_Scale; + + UpdateMap(); +} + + + + + +void cMap::SendTo(cClientHandle & a_Client) +{ + a_Client.SendMapInfo(m_ID, m_Scale); + + for (unsigned int i = 0; i < m_Width; ++i) + { + const Byte* Colors = &m_Data[i * m_Height]; + + a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height); + } +} + + + + + +unsigned int cMap::GetNumPixels(void) const +{ + return m_Width * m_Height; +} + + + + + +unsigned int cMap::GetNumBlocksPerPixel(void) const +{ + return pow(2, m_Scale); +} + + + + + -- cgit v1.2.3 From 32b465b8e1e1a6fa9e966a1376209f292331d4ae Mon Sep 17 00:00:00 2001 From: andrew Date: Thu, 13 Feb 2014 21:36:24 +0200 Subject: IDCount Serialization --- src/Map.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index f1b690698..f99b01752 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -12,6 +12,24 @@ +cMap::cMap(unsigned int a_ID, cWorld * a_World) + : m_ID(a_ID) + , m_Width(128) + , m_Height(128) + , m_Scale(3) + , m_CenterX(0) + , m_CenterZ(0) + , m_World(a_World) +{ + m_Data.assign(m_Width * m_Height, 0); + + // Do not update map +} + + + + + cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale) : m_ID(a_ID) , m_Width(128) -- cgit v1.2.3 From 5b92b877bcc0c5072dbea98b6c54106f954aa758 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 14 Feb 2014 16:21:16 +0200 Subject: Send map when selected --- src/Map.cpp | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'src/Map.cpp') 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(); } -- cgit v1.2.3 From c7fb00085854ed76b8b8945968de0505b8fbe8a2 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 14 Feb 2014 17:38:22 +0200 Subject: EmptyMap item handler --- src/Map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 4acd9512c..497cc9659 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -15,8 +15,8 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World) : m_ID(a_ID) - , m_Width(128) - , m_Height(128) + , m_Width(cChunkDef::Width * 8) + , m_Height(cChunkDef::Width * 8) , m_Scale(3) , m_CenterX(0) , m_CenterZ(0) @@ -31,8 +31,8 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World) cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, unsigned int a_Scale) : m_ID(a_ID) - , m_Width(128) - , m_Height(128) + , m_Width(cChunkDef::Width * 8) + , m_Height(cChunkDef::Width * 8) , m_Scale(a_Scale) , m_CenterX(a_CenterX) , m_CenterZ(a_CenterZ) -- cgit v1.2.3 From cf96e69716e0ccd0657cf275720bb11b915361c4 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 15 Feb 2014 20:06:47 +0200 Subject: cMap::UpdateRadius --- src/Map.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 101 insertions(+), 11 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 497cc9659..e0f991693 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -8,6 +8,7 @@ #include "ClientHandle.h" #include "World.h" #include "Chunk.h" +#include "Entities/Player.h" @@ -23,6 +24,8 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World) , m_World(a_World) { m_Data.assign(m_Width * m_Height, 0); + + Printf(m_Name, "map_%i", m_ID); } @@ -40,12 +43,34 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un { m_Data.assign(m_Width * m_Height, 0); - for (unsigned int X = 0; X < m_Width; ++X) + Printf(m_Name, "map_%i", m_ID); +} + + + + + +void cMap::UpdateRadius(int a_PixelX, int a_PixelZ, unsigned int a_Radius) +{ + int PixelRadius = a_Radius / GetPixelWidth(); + + unsigned int StartX = std::max(a_PixelX - PixelRadius, 0); + unsigned int StartZ = std::max(a_PixelZ - PixelRadius, 0); + + unsigned int EndX = std::min(a_PixelX + PixelRadius, (int)m_Width); + unsigned int EndZ = std::min(a_PixelZ + PixelRadius, (int)m_Height); + + for (unsigned int X = StartX; X < EndX; ++X) { - for (unsigned int Y = 0; Y < m_Height; ++Y) + for (unsigned int Z = StartZ; Z < EndZ; ++Z) { - // Debug - m_Data[Y + X * m_Height] = rand() % 100; + int dX = X - a_PixelX; + int dZ = Z - a_PixelZ; + + if ((dX * dX) + (dZ * dZ) < (PixelRadius * PixelRadius)) + { + UpdatePixel(X, Z); + } } } } @@ -54,20 +79,85 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un +void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius) +{ + unsigned int PixelWidth = GetPixelWidth(); + + int PixelX = (a_Player.GetPosX() - m_CenterX) / PixelWidth + (m_Width / 2); + int PixelZ = (a_Player.GetPosZ() - m_CenterZ) / PixelWidth + (m_Height / 2); + + UpdateRadius(PixelX, PixelZ, a_Radius); +} + + + + + bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y) { ASSERT(m_World != NULL); - cChunk * Chunk = NULL; + unsigned int PixelWidth = GetPixelWidth(); + + int BlockX = m_CenterX + ((a_X - m_Width) * PixelWidth); + int BlockZ = m_CenterZ + ((a_Y - m_Height) * PixelWidth); + + int ChunkX, ChunkY, ChunkZ; + m_World->BlockToChunk(BlockX, 0, BlockZ, ChunkX, ChunkY, ChunkZ); - if (Chunk == NULL) + int RelX = BlockX - (ChunkX * cChunkDef::Width); + int RelZ = BlockZ - (ChunkZ * cChunkDef::Width); + + class cCalculatePixelCb : + public cChunkCallback { - return false; - } + cMap * m_Map; + + int m_RelX, m_RelZ; + + ColorID m_PixelData; + + public: + cCalculatePixelCb(cMap * a_Map, int a_RelX, int a_RelZ) + : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(0) {} + + virtual bool Item(cChunk * a_Chunk) override + { + if (a_Chunk == NULL) + { + return false; + } - int Height = Chunk->GetHeight(a_X, a_Y); + unsigned int PixelWidth = m_Map->GetPixelWidth(); + + for (unsigned int X = m_RelX; X < m_RelX + PixelWidth; ++X) + { + for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z) + { + int Height = a_Chunk->GetHeight(X, Z); + + if (Height > 0) + { + // TODO + } + } + } + + m_PixelData = 8; // Debug + + return false; + } + + ColorID GetPixelData(void) const + { + return m_PixelData; + } + } CalculatePixelCb(this, RelX, RelZ); + + ASSERT(m_World != NULL); + m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb); - // TODO + m_Data[a_Y + (a_X * m_Height)] = CalculatePixelCb.GetPixelData(); return true; } @@ -167,7 +257,7 @@ unsigned int cMap::GetNumPixels(void) const -unsigned int cMap::GetNumBlocksPerPixel(void) const +unsigned int cMap::GetPixelWidth(void) const { return pow(2, m_Scale); } -- cgit v1.2.3 From 3b24bc870bb39a8b8812ed307250e1188b9ff788 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 17 Feb 2014 16:27:12 +0200 Subject: Map item handler; Fixed several bugs --- src/Map.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index e0f991693..e85c23d3a 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -50,15 +50,25 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un +template +T Clamp(T a_X, T a_Min, T a_Max) +{ + return std::min(std::max(a_X, a_Min), a_Max); +} + + + + + void cMap::UpdateRadius(int a_PixelX, int a_PixelZ, unsigned int a_Radius) { int PixelRadius = a_Radius / GetPixelWidth(); - unsigned int StartX = std::max(a_PixelX - PixelRadius, 0); - unsigned int StartZ = std::max(a_PixelZ - PixelRadius, 0); + unsigned int StartX = Clamp(a_PixelX - PixelRadius, 0, (int)m_Width); + unsigned int StartZ = Clamp(a_PixelZ - PixelRadius, 0, (int)m_Height); - unsigned int EndX = std::min(a_PixelX + PixelRadius, (int)m_Width); - unsigned int EndZ = std::min(a_PixelZ + PixelRadius, (int)m_Height); + unsigned int EndX = Clamp(a_PixelX + PixelRadius, 0, (int)m_Width); + unsigned int EndZ = Clamp(a_PixelZ + PixelRadius, 0, (int)m_Height); for (unsigned int X = StartX; X < EndX; ++X) { @@ -93,11 +103,9 @@ void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius) -bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y) +bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) { - ASSERT(m_World != NULL); - - unsigned int PixelWidth = GetPixelWidth(); + /*unsigned int PixelWidth = GetPixelWidth(); int BlockX = m_CenterX + ((a_X - m_Width) * PixelWidth); int BlockZ = m_CenterZ + ((a_Y - m_Height) * PixelWidth); @@ -119,7 +127,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y) public: cCalculatePixelCb(cMap * a_Map, int a_RelX, int a_RelZ) - : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(0) {} + : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(4) {} virtual bool Item(cChunk * a_Chunk) override { @@ -155,9 +163,9 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y) } CalculatePixelCb(this, RelX, RelZ); ASSERT(m_World != NULL); - m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb); + m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb);*/ - m_Data[a_Y + (a_X * m_Height)] = CalculatePixelCb.GetPixelData(); + m_Data[a_Z + (a_X * m_Height)] = 4; return true; } @@ -166,6 +174,39 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Y) +void cMap::UpdateTrackedPlayers(void) +{ + cTrackedPlayerList NewList; + + for (cTrackedPlayerList::iterator it = m_TrackedPlayers.begin(); it != m_TrackedPlayers.end(); ++it) + { + cPlayer * Player = *it; + + UpdateRadius(*Player, DEFAULT_RADIUS); + + if (true) + { + NewList.insert(Player); + } + } + + std::swap(m_TrackedPlayers, NewList); +} + + + + + +void cMap::AddTrackedPlayer(cPlayer * a_Player) +{ + ASSERT(a_Player != NULL); + m_TrackedPlayers.insert(a_Player); +} + + + + + void cMap::EraseData(void) { m_Data.assign(m_Width * m_Height, 0); -- cgit v1.2.3 From 393ca0221dfdb6dabadcf293fea86a830453c938 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 18 Feb 2014 20:50:08 +0200 Subject: Map decorators; Map clients --- src/Map.cpp | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 209 insertions(+), 23 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index e85c23d3a..f32d232fa 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -14,6 +14,111 @@ +cMapDecorator::cMapDecorator(cMap * a_Map, eType a_Type, int a_X, int a_Z, unsigned int a_Rot) + : m_Map(a_Map) + , m_Type(a_Type) + , m_PixelX(a_X) + , m_PixelZ(a_Z) + , m_Rot(a_Rot) + , m_Player(NULL) +{ +} + + + + + +cMapDecorator::cMapDecorator(cMap * a_Map, cPlayer * a_Player) + : m_Map(a_Map) + , m_Type(E_TYPE_PLAYER) + , m_Player(a_Player) +{ + Update(); +} + + + + + +template +T Clamp(T a_X, T a_Min, T a_Max) +{ + return std::min(std::max(a_X, a_Min), a_Max); +} + + + + + +void cMapDecorator::Update(void) +{ + ASSERT(m_Map != NULL); + unsigned int PixelWidth = m_Map->GetPixelWidth(); + + int InsideWidth = (m_Map->GetWidth() / 2) - 1; + int InsideHeight = (m_Map->GetHeight() / 2) - 1; + + if (m_Player) + { + int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; + int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; + + // Center of pixel + m_PixelX = (2 * PixelX) + 1; + m_PixelZ = (2 * PixelZ) + 1; + + // 1px border + if ((PixelX > -InsideWidth) && (PixelX <= InsideWidth) && (PixelZ > -InsideHeight) && (PixelZ <= InsideHeight)) + { + double Yaw = m_Player->GetYaw(); + + m_Rot = (Yaw * 16) / 360; + + if (m_Map->GetDimension() == dimNether) + { + Int64 WorldAge = m_Player->GetWorld()->GetWorldAge(); + + // TODO 2014-02-18 xdot: Random rotations + } + + m_Type = E_TYPE_PLAYER; + } + else + { + if ((abs(PixelX) > 320.0) || (abs(PixelZ) > 320.0)) + { + // TODO 2014-02-18 xdot: Remove decorator + } + + m_Rot = 0; + + m_Type = E_TYPE_PLAYER_OUTSIDE; + + // Move to border + if (PixelX <= -InsideWidth) + { + m_PixelX = (2 * -InsideWidth) + 1; + } + if (PixelZ <= -InsideHeight) + { + m_PixelZ = (2 * -InsideHeight) + 1; + } + if (PixelX > InsideWidth) + { + m_PixelX = (2 * InsideWidth) + 1; + } + if (PixelZ > InsideHeight) + { + m_PixelZ = (2 * InsideHeight) + 1; + } + } + } +} + + + + + cMap::cMap(unsigned int a_ID, cWorld * a_World) : m_ID(a_ID) , m_Width(cChunkDef::Width * 8) @@ -50,16 +155,6 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un -template -T Clamp(T a_X, T a_Min, T a_Max) -{ - return std::min(std::max(a_X, a_Min), a_Max); -} - - - - - void cMap::UpdateRadius(int a_PixelX, int a_PixelZ, unsigned int a_Radius) { int PixelRadius = a_Radius / GetPixelWidth(); @@ -174,33 +269,117 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) -void cMap::UpdateTrackedPlayers(void) +void cMap::UpdateDecorators(void) +{ + for (cMapDecoratorList::iterator it = m_Decorators.begin(); it != m_Decorators.end(); ++it) + { + it->Update(); + } +} + + + + + +void cMap::UpdateClient(cPlayer * a_Player) { - cTrackedPlayerList NewList; + ASSERT(a_Player != NULL); + cClientHandle * Handle = a_Player->GetClientHandle(); - for (cTrackedPlayerList::iterator it = m_TrackedPlayers.begin(); it != m_TrackedPlayers.end(); ++it) + if (Handle == NULL) { - cPlayer * Player = *it; + return; + } + + Int64 WorldAge = a_Player->GetWorld()->GetWorldAge(); - UpdateRadius(*Player, DEFAULT_RADIUS); + // Remove invalid clients + for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end();) + { + // Check if client is active + if (it->m_LastUpdate < WorldAge - 5) + { + // Remove associated decorators + for (cMapDecoratorList::iterator it2 = m_Decorators.begin(); it2 != m_Decorators.end();) + { + if (it2->GetPlayer()->GetClientHandle() == Handle) + { + // Erase decorator + cMapDecoratorList::iterator temp = it2; + ++it2; + m_Decorators.erase(temp); + } + else + { + ++it2; + } + } - if (true) + // Erase client + cMapClientList::iterator temp = it; + ++it; + m_Clients.erase(temp); + } + else { - NewList.insert(Player); + ++it; } } - std::swap(m_TrackedPlayers, NewList); -} + // Linear search for client state + for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end(); ++it) + { + if (it->m_Handle == Handle) + { + it->m_LastUpdate = WorldAge; + if (it->m_SendInfo) + { + Handle->SendMapInfo(m_ID, m_Scale); + it->m_SendInfo = false; + return; + } + ++it->m_NextDecoratorUpdate; -void cMap::AddTrackedPlayer(cPlayer * a_Player) -{ - ASSERT(a_Player != NULL); - m_TrackedPlayers.insert(a_Player); + if (it->m_NextDecoratorUpdate >= 4) + { + UpdateDecorators(); + + Handle->SendMapDecorators(m_ID, m_Decorators); + + it->m_NextDecoratorUpdate = 0; + } + else + { + ++it->m_DataUpdate; + + unsigned int Y = (it->m_DataUpdate * 11) % m_Width; + + const Byte * Colors = &m_Data[Y * m_Height]; + + Handle->SendMapColumn(m_ID, Y, 0, Colors, m_Height); + } + + return; + } + } + + // New player, construct a new client state + cMapClient MapClient; + + MapClient.m_LastUpdate = WorldAge; + MapClient.m_SendInfo = true; + MapClient.m_Handle = a_Player->GetClientHandle(); + + m_Clients.push_back(MapClient); + + // Insert new decorator + cMapDecorator PlayerDecorator(this, a_Player); + + m_Decorators.push_back(PlayerDecorator); } @@ -267,6 +446,11 @@ void cMap::SetScale(unsigned int a_Scale) } m_Scale = a_Scale; + + for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end(); ++it) + { + it->m_SendInfo = true; + } } @@ -283,6 +467,8 @@ void cMap::SendTo(cClientHandle & a_Client) a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height); } + + a_Client.SendMapDecorators(m_ID, m_Decorators); } -- cgit v1.2.3 From 4a1ac5740869356880523dde83ec0b7804689d42 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 19 Feb 2014 15:28:48 +0200 Subject: Documented cMap --- src/Map.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index f32d232fa..4f8924af2 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -14,7 +14,7 @@ -cMapDecorator::cMapDecorator(cMap * a_Map, eType a_Type, int a_X, int a_Z, unsigned int a_Rot) +cMapDecorator::cMapDecorator(cMap * a_Map, eType a_Type, int a_X, int a_Z, int a_Rot) : m_Map(a_Map) , m_Type(a_Type) , m_PixelX(a_X) @@ -58,7 +58,7 @@ void cMapDecorator::Update(void) int InsideWidth = (m_Map->GetWidth() / 2) - 1; int InsideHeight = (m_Map->GetHeight() / 2) - 1; - if (m_Player) + if (m_Player != NULL) { int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; @@ -200,7 +200,8 @@ void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius) bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) { - /*unsigned int PixelWidth = GetPixelWidth(); + /* + unsigned int PixelWidth = GetPixelWidth(); int BlockX = m_CenterX + ((a_X - m_Width) * PixelWidth); int BlockZ = m_CenterZ + ((a_Y - m_Height) * PixelWidth); @@ -258,7 +259,8 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) } CalculatePixelCb(this, RelX, RelZ); ASSERT(m_World != NULL); - m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb);*/ + m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb); + */ m_Data[a_Z + (a_X * m_Height)] = 4; @@ -346,6 +348,8 @@ void cMap::UpdateClient(cPlayer * a_Player) if (it->m_NextDecoratorUpdate >= 4) { + // TODO 2014-02-19 xdot + // This is dangerous as the player object may have been destroyed before the decorator is erased from the list UpdateDecorators(); Handle->SendMapDecorators(m_ID, m_Decorators); -- cgit v1.2.3 From 58a708825fa7e79c9dcbe6ad1bbbb2c0c3247edc Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 19 Feb 2014 20:57:14 +0200 Subject: cMapDecorator: Implemented random rotations --- src/Map.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 4f8924af2..a194dbd96 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -9,6 +9,7 @@ #include "World.h" #include "Chunk.h" #include "Entities/Player.h" +#include "FastRandom.h" @@ -52,14 +53,14 @@ T Clamp(T a_X, T a_Min, T a_Max) void cMapDecorator::Update(void) { - ASSERT(m_Map != NULL); - unsigned int PixelWidth = m_Map->GetPixelWidth(); - - int InsideWidth = (m_Map->GetWidth() / 2) - 1; - int InsideHeight = (m_Map->GetHeight() / 2) - 1; - if (m_Player != NULL) { + ASSERT(m_Map != NULL); + unsigned int PixelWidth = m_Map->GetPixelWidth(); + + int InsideWidth = (m_Map->GetWidth() / 2) - 1; + int InsideHeight = (m_Map->GetHeight() / 2) - 1; + int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; @@ -67,18 +68,22 @@ void cMapDecorator::Update(void) m_PixelX = (2 * PixelX) + 1; m_PixelZ = (2 * PixelZ) + 1; - // 1px border if ((PixelX > -InsideWidth) && (PixelX <= InsideWidth) && (PixelZ > -InsideHeight) && (PixelZ <= InsideHeight)) { double Yaw = m_Player->GetYaw(); - m_Rot = (Yaw * 16) / 360; - if (m_Map->GetDimension() == dimNether) { + cFastRandom Random; + Int64 WorldAge = m_Player->GetWorld()->GetWorldAge(); - // TODO 2014-02-18 xdot: Random rotations + // TODO 2014-02-19 xdot: Refine + m_Rot = Random.NextInt(16, WorldAge); + } + else + { + m_Rot = (Yaw * 16) / 360; } m_Type = E_TYPE_PLAYER; -- cgit v1.2.3 From 8bf5d116fe4c7b2addeba2dac9a8b1fc93486444 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 21 Feb 2014 15:26:33 +0200 Subject: Split cMap::UpdateClient --- src/Map.cpp | 126 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 50 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index cb5472a22..0028a1e94 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -278,28 +278,35 @@ void cMap::UpdateDecorators(void) -void cMap::UpdateClient(cPlayer * a_Player) +void cMap::AddPlayer(cPlayer * a_Player, cClientHandle * a_Handle, Int64 a_WorldAge) { - ASSERT(a_Player != NULL); - cClientHandle * Handle = a_Player->GetClientHandle(); + cMapClient MapClient; + + MapClient.m_LastUpdate = a_WorldAge; + MapClient.m_SendInfo = true; + MapClient.m_Handle = a_Handle; + + m_Clients.push_back(MapClient); + + cMapDecorator PlayerDecorator(this, a_Player); + + m_Decorators.push_back(PlayerDecorator); +} + + - if (Handle == NULL) - { - return; - } - Int64 WorldAge = a_Player->GetWorld()->GetWorldAge(); - // Remove invalid clients +void cMap::RemoveInactiveClients(Int64 a_WorldAge) +{ for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end();) { - // Check if client is active - if (it->m_LastUpdate < WorldAge - 5) + if (it->m_LastUpdate < a_WorldAge) { // Remove associated decorators for (cMapDecoratorList::iterator it2 = m_Decorators.begin(); it2 != m_Decorators.end();) { - if (it2->GetPlayer()->GetClientHandle() == Handle) + if (it2->GetPlayer()->GetClientHandle() == it->m_Handle) { // Erase decorator cMapDecoratorList::iterator temp = it2; @@ -322,63 +329,82 @@ void cMap::UpdateClient(cPlayer * a_Player) ++it; } } +} - // Linear search for client state - for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end(); ++it) + + + + +void cMap::StreamNext(cMapClient & a_Client) +{ + cClientHandle * Handle = a_Client.m_Handle; + + if (a_Client.m_SendInfo) { - if (it->m_Handle == Handle) - { - it->m_LastUpdate = WorldAge; + Handle->SendMapInfo(m_ID, m_Scale); - if (it->m_SendInfo) - { - Handle->SendMapInfo(m_ID, m_Scale); + a_Client.m_SendInfo = false; - it->m_SendInfo = false; + return; + } - return; - } + ++a_Client.m_NextDecoratorUpdate; - ++it->m_NextDecoratorUpdate; + if (a_Client.m_NextDecoratorUpdate >= 4) + { + // TODO 2014-02-19 xdot + // This is dangerous as the player object may have been destroyed before the decorator is erased from the list + UpdateDecorators(); - if (it->m_NextDecoratorUpdate >= 4) - { - // TODO 2014-02-19 xdot - // This is dangerous as the player object may have been destroyed before the decorator is erased from the list - UpdateDecorators(); + Handle->SendMapDecorators(m_ID, m_Decorators); - Handle->SendMapDecorators(m_ID, m_Decorators); + a_Client.m_NextDecoratorUpdate = 0; + } + else + { + ++a_Client.m_DataUpdate; - it->m_NextDecoratorUpdate = 0; - } - else - { - ++it->m_DataUpdate; + unsigned int Y = (a_Client.m_DataUpdate * 11) % m_Width; - unsigned int Y = (it->m_DataUpdate * 11) % m_Width; + const Byte * Colors = &m_Data[Y * m_Height]; - const Byte * Colors = &m_Data[Y * m_Height]; + Handle->SendMapColumn(m_ID, Y, 0, Colors, m_Height); + } +} - Handle->SendMapColumn(m_ID, Y, 0, Colors, m_Height); - } - return; - } + + + +void cMap::UpdateClient(cPlayer * a_Player) +{ + ASSERT(a_Player != NULL); + cClientHandle * Handle = a_Player->GetClientHandle(); + + if (Handle == NULL) + { + return; } - // New player, construct a new client state - cMapClient MapClient; + Int64 WorldAge = a_Player->GetWorld()->GetWorldAge(); - MapClient.m_LastUpdate = WorldAge; - MapClient.m_SendInfo = true; - MapClient.m_Handle = a_Player->GetClientHandle(); + RemoveInactiveClients(WorldAge - 5); - m_Clients.push_back(MapClient); + // Linear search for client state + for (cMapClientList::iterator it = m_Clients.begin(); it != m_Clients.end(); ++it) + { + if (it->m_Handle == Handle) + { + it->m_LastUpdate = WorldAge; - // Insert new decorator - cMapDecorator PlayerDecorator(this, a_Player); + StreamNext(*it); - m_Decorators.push_back(PlayerDecorator); + return; + } + } + + // New player, construct a new client state + AddPlayer(a_Player, Handle, WorldAge); } -- cgit v1.2.3 From a96eea5e66191ee02c21e3ce3f33277c516142bc Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 22 Feb 2014 12:50:30 +0200 Subject: Semi-working implementation of cMap::UpdatePixel --- src/Map.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 11 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 0028a1e94..87fe9555f 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -123,7 +123,7 @@ cMap::cMap(unsigned int a_ID, cWorld * a_World) , m_CenterZ(0) , m_World(a_World) { - m_Data.assign(m_Width * m_Height, 0); + m_Data.assign(m_Width * m_Height, E_BASE_COLOR_TRANSPARENT); Printf(m_Name, "map_%i", m_ID); } @@ -141,7 +141,7 @@ cMap::cMap(unsigned int a_ID, int a_CenterX, int a_CenterZ, cWorld * a_World, un , m_CenterZ(a_CenterZ) , m_World(a_World) { - m_Data.assign(m_Width * m_Height, 0); + m_Data.assign(m_Width * m_Height, E_BASE_COLOR_TRANSPARENT); Printf(m_Name, "map_%i", m_ID); } @@ -195,11 +195,10 @@ void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius) bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) { - /* unsigned int PixelWidth = GetPixelWidth(); - int BlockX = m_CenterX + ((a_X - m_Width) * PixelWidth); - int BlockZ = m_CenterZ + ((a_Y - m_Height) * PixelWidth); + int BlockX = m_CenterX + ((a_X - (m_Width / 2)) * PixelWidth); + int BlockZ = m_CenterZ + ((a_Z - (m_Height / 2)) * PixelWidth); int ChunkX, ChunkY, ChunkZ; m_World->BlockToChunk(BlockX, 0, BlockZ, ChunkX, ChunkY, ChunkZ); @@ -218,7 +217,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) public: cCalculatePixelCb(cMap * a_Map, int a_RelX, int a_RelZ) - : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(4) {} + : m_Map(a_Map), m_RelX(a_RelX), m_RelZ(a_RelZ), m_PixelData(E_BASE_COLOR_TRANSPARENT) {} virtual bool Item(cChunk * a_Chunk) override { @@ -229,20 +228,88 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) unsigned int PixelWidth = m_Map->GetPixelWidth(); + if (m_Map->GetDimension() == dimNether) + { + // TODO 2014-02-22 xdot: Nether maps + + return false; + } + + typedef std::map ColorCountMap; + ColorCountMap ColorCounts; + + // Count surface blocks for (unsigned int X = m_RelX; X < m_RelX + PixelWidth; ++X) { for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z) { + unsigned int WaterDepth = 0; + + BLOCKTYPE TargetBlock = E_BLOCK_AIR; + NIBBLETYPE TargetMeta = 0; + int Height = a_Chunk->GetHeight(X, Z); - if (Height > 0) + while (Height > 0) + { + a_Chunk->GetBlockTypeMeta(X, Height, Z, TargetBlock, TargetMeta); + + // TODO 2014-02-22 xdot: Check if block color is transparent + if (TargetBlock == E_BLOCK_AIR) + { + --Height; + continue; + } + // TODO 2014-02-22 xdot: Check if block is liquid + else if (false) + { + --Height; + ++WaterDepth; + continue; + } + + break; + } + + // TODO 2014-02-22 xdot: Query block color + ColorID Color = E_BASE_COLOR_BROWN; + + // Debug - Temporary + switch (TargetBlock) { - // TODO + case E_BLOCK_GRASS: + { + Color = E_BASE_COLOR_LIGHT_GREEN; break; + } + case E_BLOCK_STATIONARY_WATER: + case E_BLOCK_WATER: + { + Color = E_BASE_COLOR_BLUE; break; + } } + + ++ColorCounts[Color]; + } + } + + // Find dominant color + ColorID PixelColor = E_BASE_COLOR_TRANSPARENT; + + unsigned int MaxCount = 0; + + for (ColorCountMap::iterator it = ColorCounts.begin(); it != ColorCounts.end(); ++it) + { + if (it->second > MaxCount) + { + PixelColor = it->first; + MaxCount = it->second; } } - m_PixelData = 8; // Debug + // TODO 2014-02-22 xdot: Adjust brightness + unsigned int dColor = 1; + + m_PixelData = PixelColor + dColor; return false; } @@ -255,9 +322,8 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) ASSERT(m_World != NULL); m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb); - */ - m_Data[a_Z + (a_X * m_Height)] = 4; + m_Data[a_Z + (a_X * m_Height)] = CalculatePixelCb.GetPixelData(); return true; } -- cgit v1.2.3 From 866fde81ca50f223c88af77d0092a2f4e60f7ce9 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 22 Feb 2014 13:59:49 +0200 Subject: Documented and exported cMap --- src/Map.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 87fe9555f..e89fad8b0 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -323,7 +323,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) ASSERT(m_World != NULL); m_World->DoWithChunk(ChunkX, ChunkZ, CalculatePixelCb); - m_Data[a_Z + (a_X * m_Height)] = CalculatePixelCb.GetPixelData(); + SetPixel(a_X, a_Z, CalculatePixelCb.GetPixelData()); return true; } @@ -516,11 +516,6 @@ void cMap::Resize(unsigned int a_Width, unsigned int a_Height) void cMap::SetPosition(int a_CenterX, int a_CenterZ) { - if ((m_CenterX == a_CenterX) && (m_CenterZ == a_CenterZ)) - { - return; - } - m_CenterX = a_CenterX; m_CenterZ = a_CenterZ; } @@ -548,6 +543,40 @@ void cMap::SetScale(unsigned int a_Scale) +bool cMap::SetPixel(unsigned int a_X, unsigned int a_Z, cMap::ColorID a_Data) +{ + if ((a_X < m_Width) && (a_Z < m_Height)) + { + m_Data[a_Z + (a_X * m_Height)] = a_Data; + + return true; + } + else + { + return false; + } +} + + + + + +cMap::ColorID cMap::GetPixel(unsigned int a_X, unsigned int a_Z) +{ + if ((a_X < m_Width) && (a_Z < m_Height)) + { + return m_Data[a_Z + (a_X * m_Height)]; + } + else + { + return E_BASE_COLOR_TRANSPARENT; + } +} + + + + + void cMap::SendTo(cClientHandle & a_Client) { a_Client.SendMapInfo(m_ID, m_Scale); @@ -575,6 +604,14 @@ unsigned int cMap::GetNumPixels(void) const +unsigned int cMap::GetNumDecorators(void) const +{ + return m_Decorators.size(); +} + + + + unsigned int cMap::GetPixelWidth(void) const { return pow(2, m_Scale); -- cgit v1.2.3 From f47187394572027cbfa07884cba2f54eaa6972ec Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 23 Feb 2014 15:03:40 +0200 Subject: Maps: Improvements --- src/Map.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index e89fad8b0..2b8c4c74c 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -344,13 +344,19 @@ void cMap::UpdateDecorators(void) -void cMap::AddPlayer(cPlayer * a_Player, cClientHandle * a_Handle, Int64 a_WorldAge) +void cMap::AddPlayer(cPlayer * a_Player, Int64 a_WorldAge) { + cClientHandle * Handle = a_Player->GetClientHandle(); + if (Handle == NULL) + { + return; + } + cMapClient MapClient; MapClient.m_LastUpdate = a_WorldAge; MapClient.m_SendInfo = true; - MapClient.m_Handle = a_Handle; + MapClient.m_Handle = Handle; m_Clients.push_back(MapClient); @@ -470,7 +476,7 @@ void cMap::UpdateClient(cPlayer * a_Player) } // New player, construct a new client state - AddPlayer(a_Player, Handle, WorldAge); + AddPlayer(a_Player, WorldAge); } -- cgit v1.2.3 From 9440b61c8c84dcc5b1348505f5e86d59be8a391d Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Mon, 24 Feb 2014 14:43:46 +0100 Subject: Fixed MCServer not compiling with C++03 compilers --- src/Map.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 2b8c4c74c..337c9cd31 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -51,8 +51,8 @@ void cMapDecorator::Update(void) int InsideWidth = (m_Map->GetWidth() / 2) - 1; int InsideHeight = (m_Map->GetHeight() / 2) - 1; - int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; - int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; + int PixelX = (int) (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth; + int PixelZ = (int) (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth; // Center of pixel m_PixelX = (2 * PixelX) + 1; @@ -69,11 +69,11 @@ void cMapDecorator::Update(void) Int64 WorldAge = m_Player->GetWorld()->GetWorldAge(); // TODO 2014-02-19 xdot: Refine - m_Rot = Random.NextInt(16, WorldAge); + m_Rot = Random.NextInt(16, (int) WorldAge); } else { - m_Rot = (Yaw * 16) / 360; + m_Rot = (int) (Yaw * 16) / 360; } m_Type = E_TYPE_PLAYER; @@ -183,8 +183,8 @@ void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius) { unsigned int PixelWidth = GetPixelWidth(); - int PixelX = (a_Player.GetPosX() - m_CenterX) / PixelWidth + (m_Width / 2); - int PixelZ = (a_Player.GetPosZ() - m_CenterZ) / PixelWidth + (m_Height / 2); + int PixelX = (int) (a_Player.GetPosX() - m_CenterX) / PixelWidth + (m_Width / 2); + int PixelZ = (int) (a_Player.GetPosZ() - m_CenterZ) / PixelWidth + (m_Height / 2); UpdateRadius(PixelX, PixelZ, a_Radius); } @@ -620,7 +620,7 @@ unsigned int cMap::GetNumDecorators(void) const unsigned int cMap::GetPixelWidth(void) const { - return pow(2, m_Scale); + return (int) pow(2.0, (double) m_Scale); } -- cgit v1.2.3 From 9c6d72a023807fca238361d636a52166f952fa59 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 27 Feb 2014 09:06:25 +0100 Subject: Fixed crash and some warnings in map handling. Fixes #728. --- src/Map.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 337c9cd31..2d8f57168 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -357,6 +357,8 @@ void cMap::AddPlayer(cPlayer * a_Player, Int64 a_WorldAge) MapClient.m_LastUpdate = a_WorldAge; MapClient.m_SendInfo = true; MapClient.m_Handle = Handle; + MapClient.m_DataUpdate = 0; + MapClient.m_NextDecoratorUpdate = 0; m_Clients.push_back(MapClient); -- cgit v1.2.3 From b829c9b14e95f37a3a5ba70fc42cb8cfe9066522 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 14 Mar 2014 07:12:00 -0700 Subject: Fixed a few unneeded breaks --- src/Map.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Map.cpp') diff --git a/src/Map.cpp b/src/Map.cpp index 2d8f57168..79370b097 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -243,7 +243,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) { for (unsigned int Z = m_RelZ; Z < m_RelZ + PixelWidth; ++Z) { - unsigned int WaterDepth = 0; + // unsigned int WaterDepth = 0; BLOCKTYPE TargetBlock = E_BLOCK_AIR; NIBBLETYPE TargetMeta = 0; @@ -261,12 +261,14 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z) continue; } // TODO 2014-02-22 xdot: Check if block is liquid + /* else if (false) { --Height; ++WaterDepth; continue; } + */ break; } -- cgit v1.2.3