Slight cleanup
It is more efficient and readable if we do nothing unless we're not locked.
This commit is contained in:
parent
57a474ba01
commit
4f8f686292
@ -684,22 +684,26 @@ void cIncrementalRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_Block
|
|||||||
void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_MyState)
|
void cIncrementalRedstoneSimulator::HandleRedstoneRepeater(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_MyState)
|
||||||
{
|
{
|
||||||
// Create a variable holding my meta to avoid multiple lookups.
|
// Create a variable holding my meta to avoid multiple lookups.
|
||||||
NIBBLETYPE a_Meta = m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
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.
|
|
||||||
{
|
if (IsRepeaterLocked(a_BlockX, a_BlockY, a_BlockZ, a_Meta)) // If we're locked, change nothing. Otherwise:
|
||||||
QueueRepeaterPowerChange(a_BlockX, a_BlockY, a_BlockZ, a_Meta, true);
|
{
|
||||||
|
// Create a variable holding being on or self powered to avoid multiple lookups.
|
||||||
|
bool IsOn = (a_MyState == E_BLOCK_REDSTONE_REPEATER_ON);
|
||||||
|
bool IsSelfPowered = IsRepeaterPowered(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (RepeatersDelayList::iterator itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end(); ++itr)
|
for (RepeatersDelayList::iterator itr = m_RepeatersDelayList->begin(); itr != m_RepeatersDelayList->end(); ++itr)
|
||||||
{
|
{
|
||||||
if (!itr->a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)))
|
if (!itr->a_BlockPos.Equals(Vector3i(a_BlockX, a_BlockY, a_BlockZ)))
|
||||||
|
Loading…
Reference in New Issue
Block a user