From ebad87d870174ed2e99be5d4f4404a8ad2aa8ab8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 9 Dec 2013 23:48:06 +0000 Subject: [PATCH] Slight redstone wire performance improvement --- src/Simulator/RedstoneSimulator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index 424e22ca4..c5fc1fb3f 100644 --- a/src/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp @@ -420,6 +420,7 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl } else { + NIBBLETYPE MetaToSet = 0; NIBBLETYPE MyMeta = m_World.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); int TimesMetaSmaller = 0, TimesFoundAWire = 0; @@ -439,7 +440,7 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl // >= to fix a bug where wires bordering each other with the same power level will appear (in terms of meta) to power each other, when they aren't actually in the powered list if (SurroundMeta >= MyMeta) { - m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, SurroundMeta - 1); + MetaToSet = SurroundMeta - 1; // To improve performance } } @@ -459,6 +460,10 @@ void cRedstoneSimulator::HandleRedstoneWire(int a_BlockX, int a_BlockY, int a_Bl m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, 0); return; // No need to process block power sets because self not powered } + else + { + m_World.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, MetaToSet); + } SetBlockPowered(a_BlockX, a_BlockY - 1, a_BlockZ, a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_REDSTONE_WIRE); // Power block beneath }