From 303b1a9c45cb74a656c9a099d669c89b92e74098 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 11:44:02 +0100 Subject: Buncha bugfixes [SEE DESC] Fixed generation values not being written Fixed piston being able to push water Fixed ice creating a non-source block (still doesn't update though) Removed problematic piston code --- source/Piston.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/Piston.cpp') diff --git a/source/Piston.cpp b/source/Piston.cpp index 161f2b38c..d75cd4989 100644 --- a/source/Piston.cpp +++ b/source/Piston.cpp @@ -12,11 +12,13 @@ #include "Server.h" #include "Blocks/BlockHandler.h" +/* #ifdef _WIN32 #include #else #include #endif +*/ //Athar from http://www.cplusplus.com/forum/unices/60161/ helped with the sleep code. @@ -128,11 +130,13 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) AddDir(extx, exty, extz, pistonMeta & 7, 1) + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7); } @@ -178,22 +182,26 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) // These cannot be moved by the sticky piston, bail out return; } + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); } else { + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0); } -- cgit v1.2.3 From ad57f1966cef14ea9f52ffbbf3677c8e24c2d5d4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 12:08:36 +0100 Subject: Okay, changed to xoft's partial fix --- source/Piston.cpp | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'source/Piston.cpp') diff --git a/source/Piston.cpp b/source/Piston.cpp index 8729287de..310fcdfd4 100644 --- a/source/Piston.cpp +++ b/source/Piston.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Piston.h" @@ -12,13 +11,6 @@ #include "Server.h" #include "Blocks/BlockHandler.h" -/* -#ifdef _WIN32 -#include -#else -#include -#endif -*/ @@ -133,16 +125,11 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) AddDir(extx, exty, extz, pistonMeta & 7, 1) - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7); } @@ -188,33 +175,23 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) // These cannot be moved by the sticky piston, bail out return; } - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); } else { - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0); } -- cgit v1.2.3