From 5c3235ecdc3f718ce20e006f1ecfa2159df82c87 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 26 May 2013 14:39:04 +0000 Subject: Implemented droppers Added a common ancestor class "DropSpenser" that has the common code for dropper and dispenser and is Lua-accessible, too. The Debuggers plugin now triggers both droppers and dispensers when rclking them with a redstone torch. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1514 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Simulator/RedstoneSimulator.cpp | 28 ++++++++++++---------------- source/Simulator/RedstoneSimulator.h | 2 +- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'source/Simulator') diff --git a/source/Simulator/RedstoneSimulator.cpp b/source/Simulator/RedstoneSimulator.cpp index 0b947b71b..03ad43ace 100644 --- a/source/Simulator/RedstoneSimulator.cpp +++ b/source/Simulator/RedstoneSimulator.cpp @@ -425,32 +425,27 @@ void cRedstoneSimulator::HandleChange(const Vector3i & a_BlockPos) } // switch (BlockType) } // while (m_RefreshPistons[]) - while (!m_RefreshDispensers.empty()) + while (!m_RefreshDropSpensers.empty()) { - Vector3i pos = m_RefreshDispensers.back(); - m_RefreshDispensers.pop_back(); + Vector3i pos = m_RefreshDropSpensers.back(); + m_RefreshDropSpensers.pop_back(); BLOCKTYPE BlockType = m_World.GetBlock(pos); - if (BlockType == E_BLOCK_DISPENSER) + if ((BlockType == E_BLOCK_DISPENSER) || (BlockType == E_BLOCK_DROPPER)) { if (IsPowered(pos)) { - class cActivateDispenser : - public cDispenserCallback + class cActivateDropSpenser : + public cDropSpenserCallback { - public: - cActivateDispenser() + virtual bool Item(cDropSpenserEntity * a_DropSpenser) override { - } - - virtual bool Item(cDispenserEntity * a_Dispenser) override - { - a_Dispenser->Activate(); + a_DropSpenser->Activate(); return false; } } ; - cActivateDispenser DispAct; - m_World.DoWithDispenserAt(pos.x, pos.y, pos.z, DispAct); + cActivateDropSpenser DrSpAct; + m_World.DoWithDropSpenserAt(pos.x, pos.y, pos.z, DrSpAct); } } } @@ -485,8 +480,9 @@ bool cRedstoneSimulator::PowerBlock(const Vector3i & a_BlockPos, const Vector3i } case E_BLOCK_DISPENSER: + case E_BLOCK_DROPPER: { - m_RefreshDispensers.push_back(a_BlockPos); + m_RefreshDropSpensers.push_back(a_BlockPos); break; } diff --git a/source/Simulator/RedstoneSimulator.h b/source/Simulator/RedstoneSimulator.h index 37c9aa92e..c0d5795c7 100644 --- a/source/Simulator/RedstoneSimulator.h +++ b/source/Simulator/RedstoneSimulator.h @@ -71,7 +71,7 @@ private: BlockList m_BlocksBuffer; BlockList m_RefreshPistons; - BlockList m_RefreshDispensers; + BlockList m_RefreshDropSpensers; BlockList m_RefreshTorchesAround; -- cgit v1.2.3