summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-16 18:55:58 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-16 18:55:58 +0200
commit6fa99a211ec792ea4dbb4a303a26608de2cd5990 (patch)
treedd5ad536c9d5579106adf377feef093cd2b6457c
parentFixed tigers weird enums (diff)
downloadcuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar.gz
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar.bz2
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar.lz
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar.xz
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.tar.zst
cuberite-6fa99a211ec792ea4dbb4a303a26608de2cd5990.zip
-rw-r--r--src/Defines.h15
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp17
2 files changed, 16 insertions, 16 deletions
diff --git a/src/Defines.h b/src/Defines.h
index 563fc308c..ee91ee596 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -274,8 +274,19 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
}
}
-
-
+inline eBlockFace ReverseBlockFace(eBlockFace a_BlockFace)
+{
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_YP: return BLOCK_FACE_YM;
+ case BLOCK_FACE_XP: return BLOCK_FACE_XM;
+ case BLOCK_FACE_ZP: return BLOCK_FACE_ZM;
+ case BLOCK_FACE_YM: return BLOCK_FACE_YP;
+ case BLOCK_FACE_XM: return BLOCK_FACE_XP;
+ case BLOCK_FACE_ZM: return BLOCK_FACE_ZP;
+ default: return a_BlockFace;
+ }
+}
/** Returns the textual representation of the BlockFace constant. */
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index 79c23a7ba..a49d0fb50 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -499,20 +499,9 @@ void cIncrementalRedstoneSimulator::HandleRedstoneLever(int a_RelBlockX, int a_R
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
eBlockFace Dir = cBlockLeverHandler::BlockMetaDataToBlockFace(Meta);
- switch (Dir) // Now, flip the direction into the type used by SetBlockLinkedPowered()
- {
- case BLOCK_FACE_YP: Dir = BLOCK_FACE_YM; break;
- case BLOCK_FACE_XP: Dir = BLOCK_FACE_XM; break;
- case BLOCK_FACE_ZP: Dir = BLOCK_FACE_ZM; break;
- case BLOCK_FACE_YM: Dir = BLOCK_FACE_YP; break;
- case BLOCK_FACE_XM: Dir = BLOCK_FACE_XP; break;
- case BLOCK_FACE_ZM :Dir = BLOCK_FACE_ZP; break;
- default:
- {
- ASSERT(!"Unhandled lever metadata!");
- return;
- }
- }
+
+ Dir = ReverseBlockFace(Dir);
+
SetDirectionLinkedPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Dir);
}
}