summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator.inc')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.inc55
1 files changed, 31 insertions, 24 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.inc b/src/Simulator/IncrementalRedstoneSimulator.inc
index e3c856328..eee2daa7c 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.inc
+++ b/src/Simulator/IncrementalRedstoneSimulator.inc
@@ -6,6 +6,8 @@
#include "RedstoneSimulator.h"
+typedef cItemCallback<cEntity> cEntityCallback;
+
@@ -1630,7 +1632,7 @@ void cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime,
}
default:
{
- LOGD("Unimplemented pressure plate type %s in cRedstoneSimulator", ItemToFullString(a_MyType).c_str());
+ LOGD("Unimplemented pressure plate type %s in cRedstoneSimulator", ItemToFullString(cItem(a_MyType)).c_str());
break;
}
}
@@ -1701,37 +1703,42 @@ void cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime,
}
}
+template <class ChestType>
+class cGetTrappedChestPlayers :
+ public cItemCallback<ChestType>
+{
+public:
+ cGetTrappedChestPlayers(void) :
+ m_NumberOfPlayers(0)
+ {
+ }
+ virtual ~cGetTrappedChestPlayers()
+ {
+ }
+ virtual bool Item(ChestType * a_Chest) override
+ {
+ ASSERT(a_Chest->GetBlockType() == E_BLOCK_TRAPPED_CHEST);
+ m_NumberOfPlayers = a_Chest->GetNumberOfPlayers();
+ return (m_NumberOfPlayers <= 0);
+ }
-template <class ChunkType, class WorldType, template <BLOCKTYPE block> class GetHandlerCompileTime, class ChestType>
-void cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime, ChestType>::HandleTrappedChest(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
-{
- class cGetTrappedChestPlayers :
- public cChestCallback
+ unsigned char GetPowerLevel(void) const
{
- public:
- cGetTrappedChestPlayers(void) :
- m_NumberOfPlayers(0)
- {
- }
+ return std::min(m_NumberOfPlayers, MAX_POWER_LEVEL);
+ }
- virtual bool Item(ChestType * a_Chest) override
- {
- ASSERT(a_Chest->GetBlockType() == E_BLOCK_TRAPPED_CHEST);
- m_NumberOfPlayers = a_Chest->GetNumberOfPlayers();
- return (m_NumberOfPlayers <= 0);
- }
+private:
+ int m_NumberOfPlayers;
- unsigned char GetPowerLevel(void) const
- {
- return std::min(m_NumberOfPlayers, MAX_POWER_LEVEL);
- }
+};
- private:
- int m_NumberOfPlayers;
- } GTCP;
+template <class ChunkType, class WorldType, template <BLOCKTYPE block> class GetHandlerCompileTime, class ChestType>
+void cIncrementalRedstoneSimulator<ChunkType, WorldType, GetHandlerCompileTime, ChestType>::HandleTrappedChest(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
+{
+ cGetTrappedChestPlayers<ChestType> GTCP;
int BlockX = m_Chunk->GetPosX() * cChunkDef::Width + a_RelBlockX;
int BlockZ = m_Chunk->GetPosZ() * cChunkDef::Width + a_RelBlockZ;