summaryrefslogtreecommitdiffstats
path: root/source/Piston.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Piston.cpp')
-rw-r--r--source/Piston.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/source/Piston.cpp b/source/Piston.cpp
index 91b1aaa93..8729287de 100644
--- a/source/Piston.cpp
+++ b/source/Piston.cpp
@@ -12,6 +12,13 @@
#include "Server.h"
#include "Blocks/BlockHandler.h"
+/*
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+*/
@@ -126,11 +133,16 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz )
AddDir(extx, exty, extz, pistonMeta & 7, 1)
- // TODO: This code needs replacing
+ /*
+ #ifdef _WIN32
// 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
- cSleep::MilliSleep(100);
+ Sleep(100);
+ #else
+ usleep(static_cast<useconds_t>(100)*1000);
+ #endif
+ */
m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7);
}
@@ -176,23 +188,33 @@ 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
- cSleep::MilliSleep(100);
+ Sleep(100);
+ #else
+ usleep(static_cast<useconds_t>(100)*1000);
+ #endif
+ */
m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta);
m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0);
}
else
{
- // TODO: This code needs replacing
+ /*
+ #ifdef _WIN32
// 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
- cSleep::MilliSleep(100);
+ Sleep(100);
+ #else
+ usleep(static_cast<useconds_t>(100)*1000);
+ #endif
+ */
m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0);
}