From 867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc Mon Sep 17 00:00:00 2001 From: faketruth Date: Thu, 1 Mar 2012 15:18:59 +0000 Subject: New redstone simulator. Should work without crashes! git-svn-id: http://mc-server.googlecode.com/svn/trunk@345 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/cChunk.cpp') diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 75dd4e77e..7e79fc806 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -464,6 +464,10 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom) if( m_World->GetBlock( XX, YY, ZZ ) == E_BLOCK_AIR ) { SetBlock( X, Y, Z, 0, 0 ); + + Vector3i wPos = PositionToWorldPosition( Vector3i(X, Y, Z) ); + + m_World->GetSimulatorManager()->WakeUp(wPos.x, wPos.y, wPos.z); if (isRedstone) { cRedstone Redstone(m_World); Redstone.ChangeRedstone( (X+m_PosX*16), (Y+m_PosY*16), (Z+m_PosZ*16), false ); @@ -953,7 +957,8 @@ void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_B const int index = a_Y + (a_Z * 128) + (a_X * 128 * 16); const char OldBlock = m_BlockType[index]; - if (OldBlock == a_BlockType) + const char OldBlockMeta = GetLight( m_BlockMeta, index ); + if (OldBlock == a_BlockType && OldBlockMeta == a_BlockMeta) { return; } @@ -1399,6 +1404,15 @@ void cChunk::PositionToWorldPosition(int a_ChunkX, int a_ChunkY, int a_ChunkZ, i +Vector3i cChunk::PositionToWorldPosition( const Vector3i & a_InChunkPos ) +{ + return Vector3i( m_PosX * 16 + a_InChunkPos.x, a_InChunkPos.y, m_PosZ * 16 + a_InChunkPos.z ); +} + + + + + #if !C_CHUNK_USE_INLINE # include "cChunk.inc" #endif -- cgit v1.2.3