summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-09-25 18:35:41 +0200
committermadmaxoft <github@xoft.cz>2014-09-25 18:36:11 +0200
commitc6f78d516b356c9ea1137331fbd5eff0762aa1a9 (patch)
treef6c444f2ea897727da4b12a0be662b40f8265527 /src/Simulator/IncrementalRedstoneSimulator.cpp
parent1.8 Protocol: Fixed problems with no-payload packets. (diff)
downloadcuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar.gz
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar.bz2
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar.lz
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar.xz
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.tar.zst
cuberite-c6f78d516b356c9ea1137331fbd5eff0762aa1a9.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index 7b3a2c2fa..8649a1841 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -1619,17 +1619,22 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
{
// 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) == 0x03)
+ {
+ 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) == 0x01)
+ {
+ return true;
+ } // If so, I am latched/locked
}
break;
@@ -1641,19 +1646,23 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
{
// 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 & 0x03) == 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;
}
}