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