diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-06 22:04:58 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-06 22:04:58 +0200 |
commit | 28332c656712cc692ca8355a4f5e8c0c5012c60c (patch) | |
tree | 0e4bcf6ba99be50731d64b5add9c63bd8b1dec1a /source/RedstoneSimulator.h | |
parent | Removed a few debugging messages from the release builds. (diff) | |
download | cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar.gz cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar.bz2 cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar.lz cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar.xz cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.tar.zst cuberite-28332c656712cc692ca8355a4f5e8c0c5012c60c.zip |
Diffstat (limited to '')
-rw-r--r-- | source/RedstoneSimulator.h | 50 |
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 +}; + + + + |