diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-09-25 18:58:12 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-09-25 18:58:12 +0200 |
commit | b2f5ab96786528354164414ef1d4e23318c42ded (patch) | |
tree | d1815114848167d55c83bfc6f89d2c7048984cdb /src/Simulator | |
parent | Fixed style (diff) | |
parent | Redstone: Fixed a crash with repeaters on a chunk border. (diff) | |
download | cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar.gz cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar.bz2 cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar.lz cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar.xz cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.tar.zst cuberite-b2f5ab96786528354164414ef1d4e23318c42ded.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator.inc | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.inc b/src/Simulator/IncrementalRedstoneSimulator.inc index eee2daa7c..3fa973463 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.inc +++ b/src/Simulator/IncrementalRedstoneSimulator.inc @@ -1937,17 +1937,23 @@ bool cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime, { // Check if eastern(right) neighbor is a powered on repeater who is facing us BLOCKTYPE Block = 0; - if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, Block) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) // Is right neighbor a powered repeater? + NIBBLETYPE OtherRepeaterDir = 0; + if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) // Is right neighbor a powered repeater? { - NIBBLETYPE OtherRepeaterDir = m_Chunk->GetMeta(a_RelBlockX + 1, a_RelBlockY, a_RelBlockZ) & 0x3; - if (OtherRepeaterDir == 0x3) { return true; } // If so, I am latched/locked + if ((OtherRepeaterDir & 0x03) == 0x3) + { + return true; + } // If so, I am latched/locked } // Check if western(left) neighbor is a powered on repeater who is facing us - if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, Block) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) + if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX - 1, a_RelBlockY, a_RelBlockZ, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) { NIBBLETYPE OtherRepeaterDir = m_Chunk->GetMeta(a_RelBlockX -1, a_RelBlockY, a_RelBlockZ) & 0x3; - if (OtherRepeaterDir == 0x1) { return true; } // If so, I am latched/locked + if ((OtherRepeaterDir & 0x03) == 0x1) + { + return true; + } // If so, I am latched/locked } break; @@ -1959,17 +1965,23 @@ bool cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime, { // Check if southern(down) neighbor is a powered on repeater who is facing us BLOCKTYPE Block = 0; - if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, Block) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) + NIBBLETYPE OtherRepeaterDir = 0; + + if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) { - NIBBLETYPE OtherRepeaterDir = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ + 1) & 0x3; - if (OtherRepeaterDir == 0x0) { return true; } // If so, am latched/locked + if ((OtherRepeaterDir & 0x30 ) == 0x00) + { + return true; + } // If so, am latched/locked } // Check if northern(up) neighbor is a powered on repeater who is facing us - if (m_Chunk->UnboundedRelGetBlockType(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, Block) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) + if (m_Chunk->UnboundedRelGetBlock(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1, Block, OtherRepeaterDir) && (Block == E_BLOCK_REDSTONE_REPEATER_ON)) { - NIBBLETYPE OtherRepeaterDir = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ - 1) & 0x3; - if (OtherRepeaterDir == 0x2) { return true; } // If so, I am latched/locked + if ((OtherRepeaterDir & 0x03) == 0x02) + { + return true; + } // If so, I am latched/locked } break; |