diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-10-05 12:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 12:27:14 +0200 |
commit | a9031b6bae742b333b1b390192fa590f2ecb07ea (patch) | |
tree | b2802c81d24d339c201a0747d66ba44e9ea8b1b0 /src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp | |
parent | Fixed current end generator (#4968) (diff) | |
download | cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2 cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip |
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp | 103 |
1 files changed, 53 insertions, 50 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp b/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp index dc2c690f9..ff109c824 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.cpp @@ -30,56 +30,59 @@ -#define INVOKE_FOR_HANDLERS(Callback) \ - switch (BlockType) \ - { \ - case E_BLOCK_ACTIVATOR_RAIL: \ - case E_BLOCK_DETECTOR_RAIL: \ - case E_BLOCK_POWERED_RAIL: return PoweredRailHandler::Callback; \ - case E_BLOCK_ACTIVE_COMPARATOR: \ - case E_BLOCK_INACTIVE_COMPARATOR: return RedstoneComparatorHandler::Callback; \ - case E_BLOCK_DISPENSER: \ - case E_BLOCK_DROPPER: return DropSpenserHandler::Callback; \ - case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: \ - case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: \ - case E_BLOCK_STONE_PRESSURE_PLATE: \ - case E_BLOCK_WOODEN_PRESSURE_PLATE: return PressurePlateHandler::Callback; \ - case E_BLOCK_ACACIA_FENCE_GATE: \ - case E_BLOCK_BIRCH_FENCE_GATE: \ - case E_BLOCK_DARK_OAK_FENCE_GATE: \ - case E_BLOCK_FENCE_GATE: \ - case E_BLOCK_IRON_TRAPDOOR: \ - case E_BLOCK_JUNGLE_FENCE_GATE: \ - case E_BLOCK_SPRUCE_FENCE_GATE: \ - case E_BLOCK_TRAPDOOR: return SmallGateHandler::Callback; \ - case E_BLOCK_REDSTONE_LAMP_OFF: \ - case E_BLOCK_REDSTONE_LAMP_ON: return RedstoneLampHandler::Callback; \ - case E_BLOCK_REDSTONE_REPEATER_OFF: \ - case E_BLOCK_REDSTONE_REPEATER_ON: return RedstoneRepeaterHandler::Callback; \ - case E_BLOCK_REDSTONE_TORCH_OFF: \ - case E_BLOCK_REDSTONE_TORCH_ON: return RedstoneTorchHandler::Callback; \ - case E_BLOCK_OBSERVER: return ObserverHandler::Callback; \ - case E_BLOCK_PISTON: \ - case E_BLOCK_STICKY_PISTON: return PistonHandler::Callback; \ - case E_BLOCK_LEVER: \ - case E_BLOCK_STONE_BUTTON: \ - case E_BLOCK_WOODEN_BUTTON: return RedstoneToggleHandler::Callback; \ - case E_BLOCK_BLOCK_OF_REDSTONE: return RedstoneBlockHandler::Callback; \ - case E_BLOCK_COMMAND_BLOCK: return CommandBlockHandler::Callback; \ - case E_BLOCK_HOPPER: return HopperHandler::Callback; \ - case E_BLOCK_NOTE_BLOCK: return NoteBlockHandler::Callback; \ - case E_BLOCK_REDSTONE_WIRE: return RedstoneWireHandler::Callback; \ - case E_BLOCK_TNT: return TNTHandler::Callback; \ - case E_BLOCK_TRAPPED_CHEST: return TrappedChestHandler::Callback; \ - case E_BLOCK_TRIPWIRE_HOOK: return TripwireHookHandler::Callback; \ - default: \ - { \ - if (cBlockDoorHandler::IsDoorBlockType(BlockType)) \ - { \ - return DoorHandler::Callback; \ - } \ - } \ - } +#define INVOKE_FOR_HANDLERS(Callback) \ + do \ + { \ + switch (BlockType) \ + { \ + case E_BLOCK_ACTIVATOR_RAIL: \ + case E_BLOCK_DETECTOR_RAIL: \ + case E_BLOCK_POWERED_RAIL: return PoweredRailHandler::Callback; \ + case E_BLOCK_ACTIVE_COMPARATOR: \ + case E_BLOCK_INACTIVE_COMPARATOR: return RedstoneComparatorHandler::Callback; \ + case E_BLOCK_DISPENSER: \ + case E_BLOCK_DROPPER: return DropSpenserHandler::Callback; \ + case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: \ + case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: \ + case E_BLOCK_STONE_PRESSURE_PLATE: \ + case E_BLOCK_WOODEN_PRESSURE_PLATE: return PressurePlateHandler::Callback; \ + case E_BLOCK_ACACIA_FENCE_GATE: \ + case E_BLOCK_BIRCH_FENCE_GATE: \ + case E_BLOCK_DARK_OAK_FENCE_GATE: \ + case E_BLOCK_FENCE_GATE: \ + case E_BLOCK_IRON_TRAPDOOR: \ + case E_BLOCK_JUNGLE_FENCE_GATE: \ + case E_BLOCK_SPRUCE_FENCE_GATE: \ + case E_BLOCK_TRAPDOOR: return SmallGateHandler::Callback; \ + case E_BLOCK_REDSTONE_LAMP_OFF: \ + case E_BLOCK_REDSTONE_LAMP_ON: return RedstoneLampHandler::Callback; \ + case E_BLOCK_REDSTONE_REPEATER_OFF: \ + case E_BLOCK_REDSTONE_REPEATER_ON: return RedstoneRepeaterHandler::Callback; \ + case E_BLOCK_REDSTONE_TORCH_OFF: \ + case E_BLOCK_REDSTONE_TORCH_ON: return RedstoneTorchHandler::Callback; \ + case E_BLOCK_OBSERVER: return ObserverHandler::Callback; \ + case E_BLOCK_PISTON: \ + case E_BLOCK_STICKY_PISTON: return PistonHandler::Callback; \ + case E_BLOCK_LEVER: \ + case E_BLOCK_STONE_BUTTON: \ + case E_BLOCK_WOODEN_BUTTON: return RedstoneToggleHandler::Callback; \ + case E_BLOCK_BLOCK_OF_REDSTONE: return RedstoneBlockHandler::Callback; \ + case E_BLOCK_COMMAND_BLOCK: return CommandBlockHandler::Callback; \ + case E_BLOCK_HOPPER: return HopperHandler::Callback; \ + case E_BLOCK_NOTE_BLOCK: return NoteBlockHandler::Callback; \ + case E_BLOCK_REDSTONE_WIRE: return RedstoneWireHandler::Callback; \ + case E_BLOCK_TNT: return TNTHandler::Callback; \ + case E_BLOCK_TRAPPED_CHEST: return TrappedChestHandler::Callback; \ + case E_BLOCK_TRIPWIRE_HOOK: return TripwireHookHandler::Callback; \ + default: \ + { \ + if (cBlockDoorHandler::IsDoorBlockType(BlockType)) \ + { \ + return DoorHandler::Callback; \ + } \ + } \ + } \ + } while (false) |