Skip to content

Commit

Permalink
Fixed pistons extending
Browse files Browse the repository at this point in the history
They didn't when a source was in front, but now they do! Yay!
  • Loading branch information
tigerw committed Nov 30, 2013
1 parent dc8e8a3 commit fad43f0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Simulator/RedstoneSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,8 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block
{
// Pistons cannot be powered through their front face; this function verifies that a source meets this requirement

int OldX = a_BlockX, OldY = a_BlockY, OldZ = a_BlockZ;

for (PoweredBlocksList::iterator itr = m_PoweredBlocks.begin(); itr != m_PoweredBlocks.end(); ++itr)
{
sPoweredBlocks & Change = *itr;
Expand All @@ -860,6 +862,10 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block
{
return true;
}

a_BlockX = OldX;
a_BlockY = OldY;
a_BlockZ = OldZ;
}

for (LinkedBlocksList::iterator itr = m_LinkedPoweredBlocks.begin(); itr != m_LinkedPoweredBlocks.end(); ++itr)
Expand All @@ -874,6 +880,10 @@ bool cRedstoneSimulator::IsPistonPowered(int a_BlockX, int a_BlockY, int a_Block
{
return true;
}

a_BlockX = OldX;
a_BlockY = OldY;
a_BlockZ = OldZ;
}
return false; // Source was in front of the piston's front face
}
Expand Down

0 comments on commit fad43f0

Please sign in to comment.