summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-15 16:51:49 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-15 16:51:49 +0100
commit6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348 (patch)
tree83f3b9742b328e54b1d5d81e9c1ff76bd7657673 /src/Simulator/IncrementalRedstoneSimulator.h
parentUpdated Plugin article (diff)
downloadcuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar.gz
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar.bz2
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar.lz
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar.xz
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.tar.zst
cuberite-6eeeb2aa0129ee9664b6cf21a68517bd4b9c7348.zip
Diffstat (limited to '')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index bcf89bb82..aea668996 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -3,7 +3,7 @@
#include "RedstoneSimulator.h"
-/// Per-chunk data for the simulator, specified individual chunks to simulate; 'Data' is not used
+/// Per-chunk data for the simulator, specified individual chunks to simulate
typedef cCoordWithBlockAndBoolVector cRedstoneSimulatorChunkData;
@@ -21,7 +21,8 @@ public:
virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used
virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
- virtual bool IsAllowedBlock( BLOCKTYPE a_BlockType ) override { return IsRedstone(a_BlockType); }
+ virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override { return IsRedstone(a_BlockType); }
+ virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
enum eRedstoneDirection
{
@@ -57,22 +58,28 @@ private:
struct sRepeatersDelayList
{
Vector3i a_BlockPos;
- short a_DelayTicks;
- short a_ElapsedTicks;
+ unsigned char a_DelayTicks;
+ unsigned char a_ElapsedTicks;
bool ShouldPowerOn;
};
-
+
+public:
+
typedef std::vector <sPoweredBlocks> PoweredBlocksList;
typedef std::vector <sLinkedPoweredBlocks> LinkedBlocksList;
typedef std::vector <sSimulatedPlayerToggleableList> SimulatedPlayerToggleableList;
typedef std::vector <sRepeatersDelayList> RepeatersDelayList;
- PoweredBlocksList m_PoweredBlocks;
- LinkedBlocksList m_LinkedPoweredBlocks;
- SimulatedPlayerToggleableList m_SimulatedPlayerToggleableBlocks;
- RepeatersDelayList m_RepeatersDelayList;
+private:
+
+ cRedstoneSimulatorChunkData * m_RedstoneSimulatorChunkData;
+ PoweredBlocksList * m_PoweredBlocks;
+ LinkedBlocksList * m_LinkedPoweredBlocks;
+ SimulatedPlayerToggleableList * m_SimulatedPlayerToggleableBlocks;
+ RepeatersDelayList * m_RepeatersDelayList;
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
+ cChunk * m_Chunk;
// We want a_MyState for devices needing a full FastSetBlock (as opposed to meta) because with our simulation model, we cannot keep setting the block if it is already set correctly
// In addition to being non-performant, it would stop the player from actually breaking said device
@@ -84,8 +91,6 @@ private:
void HandleRedstoneBlock(int a_BlockX, int a_BlockY, int a_BlockZ);
/** Handles levers */
void HandleRedstoneLever(int a_BlockX, int a_BlockY, int a_BlockZ);
- /** Handles Fence Gates */
- void HandleFenceGate(int a_BlockX, int a_BlockY, int a_BlockZ);
/** Handles buttons */
void HandleRedstoneButton(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType);
/** Handles daylight sensors */
@@ -118,6 +123,8 @@ private:
void HandleRail(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_MyType);
/** Handles trapdoors */
void HandleTrapdoor(int a_BlockX, int a_BlockY, int a_BlockZ);
+ /** Handles fence gates */
+ void HandleFenceGate(int a_BlockX, int a_BlockY, int a_BlockZ);
/** Handles noteblocks */
void HandleNoteBlock(int a_BlockX, int a_BlockY, int a_BlockZ);
/* ===================== */
@@ -134,7 +141,7 @@ private:
/** Marks all blocks immediately surrounding a coordinate as powered */
void SetAllDirsAsPowered(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_SourceBlock);
/** Queues a repeater to be powered or unpowered */
- void QueueRepeaterPowerChange(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta, short a_ElapsedTicks, bool ShouldPowerOn);
+ void QueueRepeaterPowerChange(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta, bool ShouldPowerOn);
/** Returns if a coordinate is powered or linked powered */
bool AreCoordsPowered(int a_BlockX, int a_BlockY, int a_BlockZ) { return AreCoordsDirectlyPowered(a_BlockX, a_BlockY, a_BlockZ) || AreCoordsLinkedPowered(a_BlockX, a_BlockY, a_BlockZ); }
@@ -267,3 +274,7 @@ private:
}
}
};
+
+
+
+