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/cPiston.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/cPiston.cpp') diff --git a/source/cPiston.cpp b/source/cPiston.cpp index 928d7c04b..1104122c8 100644 --- a/source/cPiston.cpp +++ b/source/cPiston.cpp @@ -16,6 +16,7 @@ extern bool g_BlockPistonBreakable[]; #define AddDir( x, y, z, dir, amount ) switch(dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\ case 2: (z)-=(amount); break; case 3: (z)+=(amount); break;\ case 4: (x)-=(amount); break; case 5: (x)+=(amount); break; } + #define FAST_FLOOR( x ) ( (x) < 0 ? ((int)x)-1 : ((int)x) ) cPiston::cPiston( cWorld* a_World ) @@ -77,6 +78,8 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) { Action.m_PosZ = (int)pistz; Action.m_Byte1 = 0; Action.m_Byte2 = pistonMeta; + + cChunk* Chunk = m_World->GetChunk( FAST_FLOOR(pistx/16), FAST_FLOOR(pisty/16), FAST_FLOOR(pistz/16) ); Chunk->Broadcast( Action ); m_World->FastSetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta | 8 ); @@ -109,7 +112,7 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) { Action.m_PosY = (short)pisty; Action.m_PosZ = (int)pistz; Action.m_Byte1 = 1; - Action.m_Byte1 = pistonMeta & ~(8); + Action.m_Byte2 = pistonMeta & ~(8); cChunk* Chunk = m_World->GetChunk( FAST_FLOOR(pistx/16), FAST_FLOOR(pisty/16), FAST_FLOOR(pistz/16) ); Chunk->Broadcast( Action ); m_World->FastSetBlock( pistx, pisty, pistz, pistonBlock, pistonMeta & ~(8) ); -- cgit v1.2.3