From 28332c656712cc692ca8355a4f5e8c0c5012c60c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 6 Oct 2012 20:04:58 +0000 Subject: Completely removed the old (buggy) redstone simulator. git-svn-id: http://mc-server.googlecode.com/svn/trunk@937 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/RedstoneSimulator.h | 50 +++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) (limited to 'source/RedstoneSimulator.h') 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 +}; + + + + -- cgit v1.2.3