diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-01 16:18:59 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-01 16:18:59 +0100 |
commit | 867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc (patch) | |
tree | a2f8b4a22a9b721d94ffa595ef57a07d1339f482 /source/cRedstoneSimulator.h | |
parent | Fixed the authenticator bug (diff) | |
download | cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar.gz cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar.bz2 cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar.lz cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar.xz cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.tar.zst cuberite-867fc8ee0dbebd3c09a4f7cdcbd5fb4d56f194dc.zip |
Diffstat (limited to 'source/cRedstoneSimulator.h')
-rw-r--r-- | source/cRedstoneSimulator.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/source/cRedstoneSimulator.h b/source/cRedstoneSimulator.h new file mode 100644 index 000000000..853816f3b --- /dev/null +++ b/source/cRedstoneSimulator.h @@ -0,0 +1,50 @@ +#pragma once
+
+#include "cSimulator.h"
+#include "Vector3i.h"
+
+class cRedstoneSimulator : public cSimulator
+{
+ typedef cSimulator super;
+public:
+ cRedstoneSimulator( cWorld* a_World );
+ ~cRedstoneSimulator();
+
+ virtual void Simulate( float a_Dt );
+ virtual bool IsAllowedBlock( char a_BlockID ) { return true; }
+
+ virtual void WakeUp( int a_X, int a_Y, int a_Z );
+
+ enum eRedstoneDirection
+ {
+ REDSTONE_NONE = 0,
+ REDSTONE_X_POS = 0x1,
+ REDSTONE_X_NEG = 0x2,
+ REDSTONE_Z_POS = 0x4,
+ REDSTONE_Z_NEG = 0x8,
+ };
+ eRedstoneDirection GetDirection( int a_X, int a_Y, int a_Z );
+ eRedstoneDirection GetDirection( const Vector3i & a_Pos ) { return GetDirection( a_Pos.x, a_Pos.y, a_Pos.z ); }
+private:
+ typedef std::deque <Vector3i> BlockList;
+
+ virtual void AddBlock(int a_X, int a_Y, int a_Z) {}
+
+ void HandleChange( const Vector3i & a_BlockPos );
+ BlockList RemoveCurrent( const Vector3i & a_BlockPos );
+
+ bool PowerBlock( const Vector3i & a_BlockPos, const Vector3i & a_FromBlock, char a_Power );
+ int UnPowerBlock( const Vector3i & a_BlockPos );
+
+ bool IsPowered( const Vector3i & a_BlockPos, bool a_bOnlyByWire = false );
+
+ BlockList m_Blocks;
+ BlockList m_BlocksBuffer;
+
+ BlockList m_RefreshPistons;
+
+ BlockList m_RefreshTorchesAround;
+ void RefreshTorchesAround( const Vector3i & a_BlockPos );
+
+ cCriticalSection m_CS;
+};
\ No newline at end of file |