From 744c0187ba3413d29c008f8ff5177f54540bf65b Mon Sep 17 00:00:00 2001 From: "admin@omencraft.com" Date: Wed, 9 Nov 2011 01:31:19 +0000 Subject: Redstone clocks now work. even one clocks. torches don't update themselves when placed yet, but redstone wire updates the torch. Fixed a bug with piston animations. git-svn-id: http://mc-server.googlecode.com/svn/trunk@80 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWorld.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'source/cWorld.cpp') diff --git a/source/cWorld.cpp b/source/cWorld.cpp index f372eb69d..ce5f2ed7a 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -1,5 +1,6 @@ #include "BlockID.h" #include "cWorld.h" +#include "cRedstone.h" #include "cChunk.h" #include "cClientHandle.h" #include "cPickup.h" @@ -112,6 +113,7 @@ cWorld::~cWorld() cWorld::cWorld( const char* a_WorldName ) : m_pState( new sWorldState ) , m_SpawnMonsterTime( 0.f ) + , m_RSList ( 0 ) { LOG("cWorld::cWorld(%s)", a_WorldName); m_pState->WorldName = a_WorldName; @@ -435,6 +437,39 @@ void cWorld::Tick(float a_Dt) } } } + + + + std::vector m_RSList_copy(m_RSList); + //copy(m_RSList.begin(), m_RSList.end(), m_RSList_copy.begin()); + m_RSList.erase(m_RSList.begin(),m_RSList.end()); + int tempX; + int tempY; + int tempZ; + int state; + + std::vector::const_iterator cii; + for(cii=m_RSList_copy.begin(); cii!=m_RSList_copy.end();) + { + tempX = *cii;cii++; + tempY = *cii;cii++; + tempZ = *cii;cii++; + state = *cii;cii++; + + //printf ("%i, %i, %i, %i\n",tempX,tempY,tempZ,state) ; + if ( (state == 00000) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_OFF ) ) { + FastSetBlock( tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_OFF, (int)GetBlockMeta( tempX, tempY, tempZ ) ); + cRedstone Redstone(this); + Redstone.ChangeRedstone( tempX, tempY, tempZ, false ); + } else if ( (state == 11111) && ( (int)GetBlock( tempX, tempY, tempZ ) == E_BLOCK_REDSTONE_TORCH_ON ) ) { + FastSetBlock( tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_ON, (int)GetBlockMeta( tempX, tempY, tempZ ) ); + cRedstone Redstone(this); + Redstone.ChangeRedstone( tempX, tempY, tempZ, true ); + } + + } + m_RSList_copy.erase(m_RSList_copy.begin(),m_RSList_copy.end()); + } void cWorld::GrowTree( int a_X, int a_Y, int a_Z ) -- cgit v1.2.3