summaryrefslogtreecommitdiffstats
path: root/source/RedstoneSimulator.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/RedstoneSimulator.h')
-rw-r--r--source/RedstoneSimulator.h50
1 files changed, 21 insertions, 29 deletions
diff --git a/source/RedstoneSimulator.h b/source/RedstoneSimulator.h
index 2235e200b..c1996bb4e 100644
--- a/source/RedstoneSimulator.h
+++ b/source/RedstoneSimulator.h
@@ -1,9 +1,15 @@
+
#pragma once
#include "Simulator.h"
#include "Vector3i.h"
-class cRedstoneSimulator : public cSimulator
+
+
+
+
+class cRedstoneSimulator :
+ public cSimulator
{
typedef cSimulator super;
public:
@@ -25,6 +31,13 @@ public:
};
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 ); }
+
+ static bool IsRepeaterPointingTo (const Vector3i & a_RepeaterPos, char a_MetaData, const Vector3i & a_BlockPos);
+ static bool IsRepeaterPointingAway(const Vector3i & a_RepeaterPos, char a_MetaData, const Vector3i & a_BlockPos);
+ static NIBBLETYPE RepeaterRotationToMetaData(float a_Rotation);
+ static Vector3i GetRepeaterDirection(NIBBLETYPE a_MetaData);
+
+
private:
struct sRepeaterChange
{
@@ -38,33 +51,8 @@ private:
typedef std::deque< sRepeaterChange > RepeaterList;
RepeaterList m_SetRepeaters;
- void SetRepeater( const Vector3i & a_Position, int a_Ticks, bool a_bPowerOn )
- {
- for( RepeaterList::iterator itr = m_SetRepeaters.begin(); itr != m_SetRepeaters.end(); ++itr )
- {
- sRepeaterChange & Change = *itr;
- if( Change.Position.Equals( a_Position ) )
- {
- if( Change.bPowerOn && a_bPowerOn == false )
- {
- Change.bPowerOffNextTime = true;
- }
- if( a_bPowerOn == true )
- {
- Change.bPowerOffNextTime = false;
- }
- Change.bPowerOn |= a_bPowerOn;
- return;
- }
- }
-
- sRepeaterChange RC;
- RC.Position = a_Position;
- RC.Ticks = a_Ticks;
- RC.bPowerOn = a_bPowerOn;
- RC.bPowerOffNextTime = false;
- m_SetRepeaters.push_back( RC );
- }
+
+ void SetRepeater(const Vector3i & a_Position, int a_Ticks, bool a_bPowerOn);
virtual void AddBlock(int a_X, int a_Y, int a_Z) {}
@@ -87,4 +75,8 @@ private:
void RefreshTorchesAround( const Vector3i & a_BlockPos );
cCriticalSection m_CS;
-}; \ No newline at end of file
+};
+
+
+
+