diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 14:42:35 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 14:42:35 +0100 |
commit | 423f49d175d8db6283232bd8bdc106e26bdcff4d (patch) | |
tree | 5c5cc58d1061c91d2cb39021853ce72ab59839ae /source/cChunk.inl.h | |
parent | Chunks are properly saved before being unloaded now (diff) | |
download | cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.gz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.bz2 cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.lz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.xz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.zst cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cChunk.inl.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/cChunk.inl.h b/source/cChunk.inl.h index c47061784..36a116e75 100644 --- a/source/cChunk.inl.h +++ b/source/cChunk.inl.h @@ -1,3 +1,4 @@ +
#ifndef __C_CHUNK_INL_H__
#define __C_CHUNK_INL_H__
@@ -5,6 +6,10 @@ # define MAX(a,b) (((a)>(b))?(a):(b))
#endif
+
+
+
+
__C_CHUNK_INLINE__
char cChunk::GetLight(char* a_Buffer, int a_BlockIdx)
{
@@ -23,6 +28,10 @@ char cChunk::GetLight(char* a_Buffer, int a_BlockIdx) return 0;
}
+
+
+
+
__C_CHUNK_INLINE__
char cChunk::GetLight(char* a_Buffer, int x, int y, int z)
{
@@ -41,6 +50,10 @@ char cChunk::GetLight(char* a_Buffer, int x, int y, int z) return 0;
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SetLight(char* a_Buffer, int a_BlockIdx, char a_Light)
{
@@ -57,9 +70,14 @@ void cChunk::SetLight(char* a_Buffer, int a_BlockIdx, char a_Light) a_Buffer[cindex] &= 0x0f; // Set second half to 0
a_Buffer[cindex] |= (a_Light << 4) & 0xf0;
}
+ MarkDirty();
}
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SetLight(char* a_Buffer, int x, int y, int z, char light)
{
@@ -76,9 +94,14 @@ void cChunk::SetLight(char* a_Buffer, int x, int y, int z, char light) a_Buffer[cindex] &= 0x0f; // Set second half to 0
a_Buffer[cindex] |= (light << 4) & 0xf0;
}
+ MarkDirty();
}
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SpreadLightOfBlock(char* a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff)
{
@@ -91,6 +114,10 @@ void cChunk::SpreadLightOfBlock(char* a_LightBuffer, int a_X, int a_Y, int a_Z, SetLight( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(GetLight( a_LightBuffer, a_X, a_Y, a_Z+1 ), MAX(0,CurrentLight-a_Falloff) ) );
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SpreadLightOfBlockX(char* a_LightBuffer, int a_X, int a_Y, int a_Z)
{
@@ -99,6 +126,10 @@ void cChunk::SpreadLightOfBlockX(char* a_LightBuffer, int a_X, int a_Y, int a_Z) SetLight( a_LightBuffer, a_X+1, a_Y, a_Z, MAX(GetLight( a_LightBuffer, a_X+1, a_Y, a_Z ), CurrentLight-1) );
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SpreadLightOfBlockY(char* a_LightBuffer, int a_X, int a_Y, int a_Z)
{
@@ -107,6 +138,10 @@ void cChunk::SpreadLightOfBlockY(char* a_LightBuffer, int a_X, int a_Y, int a_Z) SetLight( a_LightBuffer, a_X, a_Y+1, a_Z, MAX(GetLight( a_LightBuffer, a_X, a_Y+1, a_Z ), CurrentLight-1) );
}
+
+
+
+
__C_CHUNK_INLINE__
void cChunk::SpreadLightOfBlockZ(char* a_LightBuffer, int a_X, int a_Y, int a_Z)
{
@@ -115,4 +150,8 @@ void cChunk::SpreadLightOfBlockZ(char* a_LightBuffer, int a_X, int a_Y, int a_Z) SetLight( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(GetLight( a_LightBuffer, a_X, a_Y, a_Z+1 ), CurrentLight-1) );
}
+
+
+
+
#endif
\ No newline at end of file |