summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-04 15:42:12 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-04 15:42:12 +0200
commita94546a04710852fc7d82523e187fbd7f2a40880 (patch)
tree6a882c404ac6afbc715b1ca2b08181158113bdda
parentMerge branch 'master' into redstoneimprovements (diff)
downloadcuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar.gz
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar.bz2
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar.lz
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar.xz
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.tar.zst
cuberite-a94546a04710852fc7d82523e187fbd7f2a40880.zip
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index 6e722d0fa..3e8a4dec0 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -442,7 +442,31 @@ void cIncrementalRedstoneSimulator::HandleRedstoneLever(int a_RelBlockX, int a_R
if (IsLeverOn(Meta))
{
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, cBlockLeverHandler::BlockMetaDataToBlockFace(Meta));
+
+ NIBBLETYPE Dir = cBlockLeverHandler::BlockMetaDataToBlockFace(Meta);
+ switch (Dir)
+ {
+ case BLOCK_FACE_YP:
+ case BLOCK_FACE_XP:
+ case BLOCK_FACE_ZP:
+ {
+ Dir--;
+ break;
+ }
+ case BLOCK_FACE_XM:
+ case BLOCK_FACE_ZM:
+ case BLOCK_FACE_YM:
+ {
+ Dir++;
+ break;
+ }
+ default:
+ {
+ ASSERT(!"Unhandled lever metadata!");
+ return;
+ }
+ }
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Dir);
}
}
@@ -486,8 +510,29 @@ void cIncrementalRedstoneSimulator::HandleRedstoneButton(int a_RelBlockX, int a_
NIBBLETYPE Meta = m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
if (IsButtonOn(Meta))
{
- SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
- SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, cBlockButtonHandler::BlockMetaDataToBlockFace(Meta));
+ SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);NIBBLETYPE Dir = cBlockButtonHandler::BlockMetaDataToBlockFace(Meta);
+
+ switch (Dir)
+ {
+ case BLOCK_FACE_XP:
+ case BLOCK_FACE_ZP:
+ {
+ Dir--;
+ break;
+ }
+ case BLOCK_FACE_XM:
+ case BLOCK_FACE_ZM:
+ {
+ Dir++;
+ break;
+ }
+ default:
+ {
+ ASSERT(!"Unhandled button metadata!");
+ return;
+ }
+ }
+ SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Dir);
}
}
@@ -1207,6 +1252,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_RelBlockX, int a_R
{
public:
cPressurePlateCallback(int a_BlockX, int a_BlockY, int a_BlockZ) :
+ m_FoundEntity(false),
m_X(a_BlockX),
m_Y(a_BlockY),
m_Z(a_BlockZ)