1
0

New redstone simulator. Should work without crashes!

git-svn-id: http://mc-server.googlecode.com/svn/trunk@345 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2012-03-01 15:18:59 +00:00
parent 93d73ac520
commit 867fc8ee0d
11 changed files with 663 additions and 8 deletions

View File

@@ -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