From 99043091df952153ad4e941a30475dbd65f0c117 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 13 Dec 2013 19:01:15 +0000 Subject: [PATCH] Improved redstone loading performance --- src/Chunk.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 192c1242c..42969bf6d 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1345,7 +1345,16 @@ void cChunk::WakeUpSimulators(void) int BlockZ = z + BaseZ; for (int y = GetHeight(x, z); y >= 0; y--) { - switch (cChunkDef::GetBlock(m_BlockTypes, x, y, z)) + BLOCKTYPE Block = cChunkDef::GetBlock(m_BlockTypes, x, y, z); + + // The redstone sim takes multiple blocks, use the inbuilt checker + if (RedstoneSimulator->IsAllowedBlock(Block)) + { + RedstoneSimulator->AddBlock(BlockX, y, BlockZ, this); + continue; + } + + switch (Block) { case E_BLOCK_WATER: { @@ -1359,7 +1368,6 @@ void cChunk::WakeUpSimulators(void) } default: { - RedstoneSimulator->AddBlock(BlockX, y, BlockZ, this); // Redstone simulator checks if valid redstone block already break; } } // switch (BlockType)