From d48ce1d10fac9b38f17737ac81bfb686e410e081 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 20 Nov 2013 22:54:28 +0000 Subject: Multiple bugfixes [SEE DESC] * Fixed compilation on VC2013 * Fixed redstone self powering - still one more scenario to go + Redstone now powers block beneath * Improved code: functionized stuff, and reduced unneeded GetBlockMetas; also utilised direct chunk access, as recommended by xoft + Added torches powering blocks above it * Fixed repeaters getting power when they shouldn't - Stopped wires getting power from another wire through a block, which could lead to wire-powering loops (vanilla behaviour) --- source/Simulator/RedstoneSimulator.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'source/Simulator/RedstoneSimulator.h') diff --git a/source/Simulator/RedstoneSimulator.h b/source/Simulator/RedstoneSimulator.h index d68c6daeb..ab88f51e2 100644 --- a/source/Simulator/RedstoneSimulator.h +++ b/source/Simulator/RedstoneSimulator.h @@ -97,14 +97,23 @@ private: /* ===================== */ /* ====== Helper functions ====== */ + ///Marks a block as powered void SetBlockPowered(int a_BlockX, int a_BlockY, int a_BlockZ, int a_SourceX, int a_SourceY, int a_SourceZ, BLOCKTYPE a_SourceBlock); + ///Marks a block as being powered through another block void SetBlockLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, int a_MiddleX, int a_MiddleY, int a_MiddleZ, int a_SourceX, int a_SourceY, int a_SourceZ, BLOCKTYPE a_SourceBlock, BLOCKTYPE a_MiddeBlock); - void SetDirectionLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Direction, BLOCKTYPE a_SourceType); + ///Marks the second block in a direction as linked powered + void SetDirectionLinkedPowered(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Direction, BLOCKTYPE a_SourceBlock); + ///Marks all blocks immediately surrounding a coordinate as powered + void SetAllDirsAsPowered(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_SourceBlock); + ///Returns if a coordiante is powered or linked powered bool AreCoordsPowered(int a_BlockX, int a_BlockY, int a_BlockZ); + ///Returns if a repeater is powered bool IsRepeaterPowered(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta); + ///Returns if lever metadata marks it as emitting power bool IsLeverOn(NIBBLETYPE a_BlockMeta); + ///Returns if button metadata marks it as emitting power bool IsButtonOn(NIBBLETYPE a_BlockMeta); /* ============================== */ @@ -112,11 +121,16 @@ private: { switch (Block) { + case E_BLOCK_ACTIVATOR_RAIL: case E_BLOCK_PISTON: case E_BLOCK_STICKY_PISTON: case E_BLOCK_DISPENSER: case E_BLOCK_DROPPER: + case E_BLOCK_FENCE_GATE: + case E_BLOCK_HOPPER: + case E_BLOCK_NOTE_BLOCK: case E_BLOCK_TNT: + case E_BLOCK_TRAPDOOR: case E_BLOCK_REDSTONE_LAMP_OFF: case E_BLOCK_REDSTONE_LAMP_ON: case E_BLOCK_WOODEN_DOOR: -- cgit v1.2.3