summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-18 21:10:57 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-18 21:10:57 +0100
commit3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3 (patch)
treef33081a1326a09879b42e579ba4d6f560aeaeb19 /source/cChunk.cpp
parentFixed previous commit: forgot to remove a debugging setting (diff)
downloadcuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar.gz
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar.bz2
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar.lz
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar.xz
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.tar.zst
cuberite-3a8d2aa421fcfa11a84a911aaaa6b5aa4e16cab3.zip
Diffstat (limited to 'source/cChunk.cpp')
-rw-r--r--source/cChunk.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index afa69fb68..d070e82aa 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -47,6 +47,26 @@ extern bool g_bWaterPhysics;
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// sSetBlock:
+
+sSetBlock::sSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta ) // absolute block position
+ : x( a_X )
+ , y( a_Y )
+ , z( a_Z )
+ , BlockType( a_BlockType )
+ , BlockMeta( a_BlockMeta )
+{
+ cChunkMap::AbsoluteToRelative(x, y, z, ChunkX, ChunkZ);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cChunk:
+
cChunk::cChunk(int a_X, int a_Y, int a_Z, cWorld * a_World)
: m_bCalculateLighting( false )
, m_bCalculateHeightmap( false )
@@ -872,12 +892,9 @@ void cChunk::SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_Block
-void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta )
+void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta)
{
- if(a_X < 0 || a_X >= 16 || a_Y < 0 || a_Y >= 128 || a_Z < 0 || a_Z >= 16)
- {
- return; // Clip
- }
+ assert(!((a_X < 0 || a_X >= 16 || a_Y < 0 || a_Y >= 128 || a_Z < 0 || a_Z >= 16)));
assert(IsValid());
@@ -897,12 +914,15 @@ void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_B
m_PendingSendBlocks.push_back( index );
}
+ // It's called SetLight(), but it sets the Meta when passed the BlockMeta workspace
SetLight( m_BlockMeta, index, a_BlockMeta );
// ONLY recalculate lighting if it's necessary!
- if( g_BlockLightValue[ OldBlock ] != g_BlockLightValue[ a_BlockType ]
- || g_BlockSpreadLightFalloff[ OldBlock ] != g_BlockSpreadLightFalloff[ a_BlockType ]
- || g_BlockTransparent[ OldBlock ] != g_BlockTransparent[ a_BlockType ] )
+ if(
+ (g_BlockLightValue[ OldBlock ] != g_BlockLightValue[ a_BlockType ]) ||
+ (g_BlockSpreadLightFalloff[ OldBlock ] != g_BlockSpreadLightFalloff[ a_BlockType ]) ||
+ (g_BlockTransparent[ OldBlock ] != g_BlockTransparent[ a_BlockType ] )
+ )
{
RecalculateLighting();
}