From 46cb1e94294d835c8ab9003b4024c156ac6f021a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 14 Oct 2012 17:02:06 +0000 Subject: BlockArea: Added const-ness to non-modifying functions, so that a const cBlockArea & can be used. git-svn-id: http://mc-server.googlecode.com/svn/trunk@960 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockArea.cpp | 22 +++++++++++----------- source/BlockArea.h | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'source') diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp index 8c3888782..0ed6a15c2 100644 --- a/source/BlockArea.cpp +++ b/source/BlockArea.cpp @@ -265,7 +265,7 @@ void cBlockArea::SetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBB -BLOCKTYPE cBlockArea::GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) +BLOCKTYPE cBlockArea::GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) const { if (m_BlockTypes == NULL) { @@ -279,7 +279,7 @@ BLOCKTYPE cBlockArea::GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) -BLOCKTYPE cBlockArea::GetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ) +BLOCKTYPE cBlockArea::GetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetRelBlockType(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ); } @@ -288,7 +288,7 @@ BLOCKTYPE cBlockArea::GetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ) -NIBBLETYPE cBlockArea::GetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ) +NIBBLETYPE cBlockArea::GetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ) const { return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockMetas); } @@ -297,7 +297,7 @@ NIBBLETYPE cBlockArea::GetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ) -NIBBLETYPE cBlockArea::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) +NIBBLETYPE cBlockArea::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockMetas); } @@ -306,7 +306,7 @@ NIBBLETYPE cBlockArea::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) -NIBBLETYPE cBlockArea::GetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ) +NIBBLETYPE cBlockArea::GetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ) const { return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockLight); } @@ -315,7 +315,7 @@ NIBBLETYPE cBlockArea::GetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ) -NIBBLETYPE cBlockArea::GetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) +NIBBLETYPE cBlockArea::GetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockLight); } @@ -324,7 +324,7 @@ NIBBLETYPE cBlockArea::GetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) -NIBBLETYPE cBlockArea::GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ) +NIBBLETYPE cBlockArea::GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ) const { return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockSkyLight); } @@ -333,7 +333,7 @@ NIBBLETYPE cBlockArea::GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ) -NIBBLETYPE cBlockArea::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ) +NIBBLETYPE cBlockArea::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockSkyLight); } @@ -420,7 +420,7 @@ bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes) -int cBlockArea::MakeIndex(int a_RelX, int a_RelY, int a_RelZ) +int cBlockArea::MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const { return a_RelX + a_RelZ * m_SizeZ + a_RelY * m_SizeX * m_SizeZ; } @@ -452,7 +452,7 @@ void cBlockArea::SetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE -NIBBLETYPE cBlockArea::GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array) +NIBBLETYPE cBlockArea::GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array) const { if (a_Array == NULL) { @@ -466,7 +466,7 @@ NIBBLETYPE cBlockArea::GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NI -NIBBLETYPE cBlockArea::GetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array) +NIBBLETYPE cBlockArea::GetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array) const { return GetRelNibble(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ, a_Array); } diff --git a/source/BlockArea.h b/source/BlockArea.h index 8d374eaad..0a22274ff 100644 --- a/source/BlockArea.h +++ b/source/BlockArea.h @@ -70,14 +70,14 @@ public: void SetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight); // Getters: - BLOCKTYPE GetRelBlockType (int a_RelX, int a_RelY, int a_RelZ); - BLOCKTYPE GetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ); - NIBBLETYPE GetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ); - NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ); - NIBBLETYPE GetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ); - NIBBLETYPE GetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ); - NIBBLETYPE GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ); - NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ); + BLOCKTYPE GetRelBlockType (int a_RelX, int a_RelY, int a_RelZ) const; + BLOCKTYPE GetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ) const; + NIBBLETYPE GetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ) const; + NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ) const; + NIBBLETYPE GetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ) const; + NIBBLETYPE GetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ) const; + NIBBLETYPE GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ) const; + NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ) const; int GetSizeX(void) const { return m_SizeX; } int GetSizeY(void) const { return m_SizeY; } @@ -100,7 +100,7 @@ public: NIBBLETYPE * GetBlockLight (void) { return m_BlockLight; } // NOTE: one byte per block! NIBBLETYPE * GetBlockSkyLight(void) { return m_BlockSkyLight; } // NOTE: one byte per block! int GetBlockCount(void) const { return m_SizeX * m_SizeY * m_SizeZ; } - int MakeIndex(int a_RelX, int a_RelY, int a_RelZ); + int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const; protected: @@ -148,8 +148,8 @@ protected: void SetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array); // Basic Getters: - NIBBLETYPE GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array); - NIBBLETYPE GetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array); + NIBBLETYPE GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array) const; + NIBBLETYPE GetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array) const; // tolua_begin } ; -- cgit v1.2.3