summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-01 13:04:50 +0200
committerMattes D <github@xoft.cz>2017-09-01 13:04:50 +0200
commit496c337cdfa593654018c171f6a74c28272265b5 (patch)
treefab48316d8fd6de97500ca1b8c8c5792eb578acc /src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
parentUpdate Core plugin (diff)
downloadcuberite-496c337cdfa593654018c171f6a74c28272265b5.tar
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.gz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.bz2
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.lz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.xz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.zst
cuberite-496c337cdfa593654018c171f6a74c28272265b5.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
index 14d7baf85..93759408d 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
@@ -27,49 +27,37 @@ public:
{
UNUSED(a_Meta);
- class cPressurePlateCallback :
- public cEntityCallback
- {
- public:
- cPressurePlateCallback(void) :
- m_NumberOfEntities(0),
- m_FoundPlayer(false)
+ unsigned int NumberOfEntities;
+ bool FoundPlayer;
+ a_World.ForEachEntityInBox(cBoundingBox(Vector3d(0.5, 0, 0.5) + a_Position, 0.5, 0.5), [&](cEntity & a_Entity)
{
- }
-
- virtual bool Item(cEntity * a_Entity) override
- {
- if (a_Entity->IsPlayer())
+ if (a_Entity.IsPlayer())
{
- m_FoundPlayer = true;
+ FoundPlayer = true;
}
- m_NumberOfEntities++;
+ NumberOfEntities++;
return false;
}
-
- unsigned int m_NumberOfEntities;
- bool m_FoundPlayer;
- } PressurePlateCallback;
- a_World.ForEachEntityInBox(cBoundingBox(Vector3d(0.5, 0, 0.5) + a_Position, 0.5, 0.5), PressurePlateCallback);
+ );
switch (a_BlockType)
{
case E_BLOCK_STONE_PRESSURE_PLATE:
{
- return (PressurePlateCallback.m_FoundPlayer ? 15 : 0);
+ return (FoundPlayer ? 15 : 0);
}
case E_BLOCK_WOODEN_PRESSURE_PLATE:
{
- return (PressurePlateCallback.m_NumberOfEntities != 0 ? 15 : 0);
+ return (NumberOfEntities != 0 ? 15 : 0);
}
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
{
- return std::min(static_cast<unsigned char>(CeilC(PressurePlateCallback.m_NumberOfEntities / 10.f)), static_cast<unsigned char>(15));
+ return std::min(static_cast<unsigned char>(CeilC(NumberOfEntities / 10.f)), static_cast<unsigned char>(15));
}
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
{
- return std::min(static_cast<unsigned char>(PressurePlateCallback.m_NumberOfEntities), static_cast<unsigned char>(15));
+ return std::min(static_cast<unsigned char>(NumberOfEntities), static_cast<unsigned char>(15));
}
default:
{