diff options
author | Alexander Harkness <bearbin@gmail.com> | 2014-04-07 20:20:37 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2014-04-07 20:20:37 +0200 |
commit | 20a12beec301c15fec9356563f8327a691440f8a (patch) | |
tree | 898915574238863d7c43ac1bef80edc5ba4b8b05 /src/Simulator/IncrementalRedstoneSimulator.cpp | |
parent | Fixed some more minor issues with the redstone simulator. (diff) | |
parent | Fixed IsOn (diff) | |
download | cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar.gz cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar.bz2 cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar.lz cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar.xz cuberite-20a12beec301c15fec9356563f8327a691440f8a.tar.zst cuberite-20a12beec301c15fec9356563f8327a691440f8a.zip |
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator.cpp')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp index f12c29211..8f82c454e 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator.cpp @@ -685,19 +685,19 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_B { // Create a variable holding my meta to avoid multiple lookups. NIBBLETYPE a_Meta = m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - - // Do the same for being on, self powered or locked. - bool IsOn = (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON); - bool IsSelfPowered = IsRepeaterPowered(a_BlockX, a_BlockY, a_BlockZ, a_Meta); - bool IsLocked = IsRepeaterLocked(a_BlockX, a_BlockY, a_BlockZ, a_Meta); - - if (IsSelfPowered && !IsOn && !IsLocked) // Queue a power change if powered, but not on and not locked. - { - QueueRepeaterPowerChange(a_BlockX, a_BlockY, a_BlockZ, a_Meta, true); - } - else if (!IsSelfPowered && IsOn && !IsLocked) // Queue a power change if unpowered, on, and not locked. - { - QueueRepeaterPowerChange(a_BlockX, a_BlockY, a_BlockZ, a_Meta, false); + bool IsOn = (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON); + + if (!IsRepeaterLocked(a_BlockX, a_BlockY, a_BlockZ, a_Meta)) // If we're locked, change nothing. Otherwise: + { + bool IsSelfPowered = IsRepeaterPowered(a_BlockX, a_BlockY, a_BlockZ, a_Meta); + if (IsSelfPowered && !IsOn) // Queue a power change if powered, but not on and not locked. + { + QueueRepeaterPowerChange(a_BlockX, a_BlockY, a_BlockZ, a_Meta, true); + } + else if (!IsSelfPowered && IsOn) // Queue a power change if unpowered, on, and not locked. + { + QueueRepeaterPowerChange(a_BlockX, a_BlockY, a_BlockZ, a_Meta, false); + } } for (RepeatersDelayList::iterator itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end(); ++itr) |