summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-04-07 12:35:37 +0200
committerAlexander Harkness <bearbin@gmail.com>2014-04-07 12:35:37 +0200
commit4082adbbade69890fb275f1807f061c8b206070e (patch)
tree365981b3aaff5af92fefeca613ecdba4de59b832 /src/Simulator
parentMerge pull request #861 from worktycho/simulator (diff)
downloadcuberite-4082adbbade69890fb275f1807f061c8b206070e.tar
cuberite-4082adbbade69890fb275f1807f061c8b206070e.tar.gz
cuberite-4082adbbade69890fb275f1807f061c8b206070e.tar.bz2
cuberite-4082adbbade69890fb275f1807f061c8b206070e.tar.lz
cuberite-4082adbbade69890fb275f1807f061c8b206070e.tar.xz
cuberite-4082adbbade69890fb275f1807f061c8b206070e.tar.zst
cuberite-4082adbbade69890fb275f1807f061c8b206070e.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index b59f95cfd..0c032eeab 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -1,4 +1,3 @@
-
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "IncrementalRedstoneSimulator.h"
@@ -686,15 +685,15 @@ void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_B
{
NIBBLETYPE a_Meta = m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
- bool IsOn = ((a_MyState == E_BLOCK_REDSTONE_REPEATER_ON) ? true : false); // Cache if repeater is on
- bool IsSelfPowered = IsRepeaterPowered(a_BlockX, a_BlockY, a_BlockZ, a_Meta & 0x3); // Cache if repeater is pwoered
- bool IsLocked = IsRepeaterLocked(a_BlockX, a_BlockY, a_BlockZ, a_Meta & 0x3);
+ bool IsOn = ((a_MyState == E_BLOCK_REDSTONE_REPEATER_ON) ? true : false); // Cache if repeater is on.
+ bool IsSelfPowered = IsRepeaterPowered(a_BlockX, a_BlockY, a_BlockZ, a_Meta & 0x3); // Cache if repeater is powered.
+ bool IsLocked = IsRepeaterLocked(a_BlockX, a_BlockY, a_BlockZ, a_Meta & 0x3); // Cache if repeater is locked.
- if (IsSelfPowered && !IsOn && !IsLocked) // Queue a power change if I am receiving power but not on
+ 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 I am not receiving power but on
+ 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);
}
@@ -1225,7 +1224,6 @@ bool cIncrementalRedstoneSimulator::IsRepeaterPowered(int a_BlockX, int a_BlockY
bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
{
// Repeaters can be locked by either of their sides
-
for (PoweredBlocksList::const_iterator itr = m_PoweredBlocks->begin(); itr != m_PoweredBlocks->end(); ++itr)
{
if (!itr->a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ))) { continue; }
@@ -1275,7 +1273,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_BlockX, int a_BlockY,
}
}
}
- return false; // Couldn't find power source behind repeater
+ return false; // Repeater is not being powered from either side, therefore it is not locked.
}