summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-29 12:56:22 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-29 12:56:22 +0200
commitae4371a733ee3ac029498ddef50850cc0ca9cbd9 (patch)
tree41f857d38ec0772b3d936361cdbb6eae1f11ec6a /src/Simulator/IncrementalRedstoneSimulator.cpp
parentFixed a food saturation issue (diff)
downloadcuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar.gz
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar.bz2
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar.lz
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar.xz
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.tar.zst
cuberite-ae4371a733ee3ac029498ddef50850cc0ca9cbd9.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index c24b1c4b3..51a7c2886 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -1489,41 +1489,36 @@ bool cIncrementalRedstoneSimulator::IsPistonPowered(int a_RelBlockX, int a_RelBl
{
// Pistons cannot be powered through their front face; this function verifies that a source meets this requirement
- int OldX = a_RelBlockX, OldY = a_RelBlockY, OldZ = a_RelBlockZ;
eBlockFace Face = cBlockPistonHandler::MetaDataToDirection(a_Meta);
- int BlockX = (m_Chunk->GetPosX() * cChunkDef::Width) + a_RelBlockX;
- int BlockZ = (m_Chunk->GetPosZ() * cChunkDef::Width) + a_RelBlockZ;
+ int BlockX = m_Chunk->GetPosX() * cChunkDef::Width + a_RelBlockX;
+ int BlockZ = m_Chunk->GetPosZ() * cChunkDef::Width + a_RelBlockZ;
for (PoweredBlocksList::const_iterator itr = m_PoweredBlocks->begin(); itr != m_PoweredBlocks->end(); ++itr)
{
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
- AddFaceDirection(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Face);
+ AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face);
if (!itr->a_SourcePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
{
return true;
}
- a_RelBlockX = OldX;
- a_RelBlockY = OldY;
- a_RelBlockZ = OldZ;
+ AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face, true);
}
for (LinkedBlocksList::const_iterator itr = m_LinkedPoweredBlocks->begin(); itr != m_LinkedPoweredBlocks->end(); ++itr)
{
if (!itr->a_BlockPos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ))) { continue; }
- AddFaceDirection(a_RelBlockX, a_RelBlockY, a_RelBlockZ, Face);
+ AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face);
if (!itr->a_MiddlePos.Equals(Vector3i(BlockX, a_RelBlockY, BlockZ)))
{
return true;
}
- a_RelBlockX = OldX;
- a_RelBlockY = OldY;
- a_RelBlockZ = OldZ;
+ AddFaceDirection(BlockX, a_RelBlockY, BlockZ, Face, true);
}
return false; // Source was in front of the piston's front face
}