summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-08-06 17:14:39 +0200
committerMattes D <github@xoft.cz>2014-08-06 17:14:39 +0200
commiteae42d91f91eadeb9b1d021a685c7cc2b3799ebe (patch)
treecc197b2a677edaa30667e71caae4ee93d5bbd8e5 /src/Simulator
parentResending fire to the client when the interact cancelled. (diff)
parentFixed style issues (diff)
downloadcuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.gz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.bz2
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.lz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.xz
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.tar.zst
cuberite-eae42d91f91eadeb9b1d021a685c7cc2b3799ebe.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index c1a2fcaae..7b3a2c2fa 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -3,11 +3,9 @@
#include "IncrementalRedstoneSimulator.h"
#include "BoundingBox.h"
-#include "../BlockEntities/DropSpenserEntity.h"
-#include "../BlockEntities/NoteEntity.h"
+#include "../BlockEntities/RedstonePoweredEntity.h"
#include "../BlockEntities/ChestEntity.h"
#include "../BlockEntities/CommandBlockEntity.h"
-#include "../Entities/TNTEntity.h"
#include "../Entities/Pickup.h"
#include "../Blocks/BlockTorch.h"
#include "../Blocks/BlockDoor.h"
@@ -842,13 +840,13 @@ void cIncrementalRedstoneSimulator::HandlePiston(int a_RelBlockX, int a_RelBlock
void cIncrementalRedstoneSimulator::HandleDropSpenser(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ)
{
class cSetPowerToDropSpenser :
- public cDropSpenserCallback
+ public cRedstonePoweredCallback
{
bool m_IsPowered;
public:
cSetPowerToDropSpenser(bool a_IsPowered) : m_IsPowered(a_IsPowered) {}
- virtual bool Item(cDropSpenserEntity * a_DropSpenser) override
+ virtual bool Item(cRedstonePoweredEntity * a_DropSpenser) override
{
a_DropSpenser->SetRedstonePower(m_IsPowered);
return false;
@@ -857,7 +855,7 @@ void cIncrementalRedstoneSimulator::HandleDropSpenser(int a_RelBlockX, int a_Rel
int BlockX = (m_Chunk->GetPosX() * cChunkDef::Width) + a_RelBlockX;
int BlockZ = (m_Chunk->GetPosZ() * cChunkDef::Width) + a_RelBlockZ;
- m_Chunk->DoWithDropSpenserAt(BlockX, a_RelBlockY, BlockZ, DrSpSP);
+ m_Chunk->DoWithRedstonePoweredEntityAt(BlockX, a_RelBlockY, BlockZ, DrSpSP);
}
@@ -1034,25 +1032,21 @@ void cIncrementalRedstoneSimulator::HandleNoteBlock(int a_RelBlockX, int a_RelBl
if (!AreCoordsSimulated(a_RelBlockX, a_RelBlockY, a_RelBlockZ, true))
{
class cSetPowerToNoteBlock :
- public cNoteBlockCallback
+ public cRedstonePoweredCallback
{
- bool m_IsPowered;
public:
- cSetPowerToNoteBlock(bool a_IsPowered) : m_IsPowered(a_IsPowered) {}
+ cSetPowerToNoteBlock() {}
- virtual bool Item(cNoteEntity * a_NoteBlock) override
+ virtual bool Item(cRedstonePoweredEntity * a_NoteBlock) override
{
- if (m_IsPowered)
- {
- a_NoteBlock->MakeSound();
- }
+ a_NoteBlock->SetRedstonePower(true);
return false;
}
- } NoteBlockSP(m_bAreCoordsPowered);
+ } NoteBlockSP;
int BlockX = (m_Chunk->GetPosX() * cChunkDef::Width) + a_RelBlockX;
int BlockZ = (m_Chunk->GetPosZ() * cChunkDef::Width) + a_RelBlockZ;
- m_Chunk->DoWithNoteBlockAt(BlockX, a_RelBlockY, BlockZ, NoteBlockSP);
+ m_Chunk->DoWithRedstonePoweredEntityAt(BlockX, a_RelBlockY, BlockZ, NoteBlockSP);
SetPlayerToggleableBlockAsSimulated(a_RelBlockX, a_RelBlockY, a_RelBlockZ, true);
}
}