Partially fixed tonibm19's mess.
This commit is contained in:
parent
7803bde6b6
commit
b1a892bd9a
@ -12,18 +12,16 @@
|
|||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
#include "Blocks/BlockHandler.h"
|
#include "Blocks/BlockHandler.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//Athar from http://www.cplusplus.com/forum/unices/60161/ helped with the sleep code.
|
|
||||||
|
|
||||||
|
|
||||||
extern bool g_BlockPistonBreakable[];
|
extern bool g_BlockPistonBreakable[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AddDir( x, y, z, dir, amount ) \
|
#define AddDir( x, y, z, dir, amount ) \
|
||||||
switch (dir) \
|
switch (dir) \
|
||||||
{ \
|
{ \
|
||||||
@ -128,11 +126,11 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz )
|
|||||||
|
|
||||||
AddDir(extx, exty, extz, pistonMeta & 7, 1)
|
AddDir(extx, exty, extz, pistonMeta & 7, 1)
|
||||||
|
|
||||||
#ifdef _WIN32
|
// TODO: This code needs replacing
|
||||||
Sleep(100);
|
// Sleeping here will play the piston animation on the client; however, it will block the entire server
|
||||||
#else
|
// for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad
|
||||||
usleep(static_cast<useconds_t>(100)*1000);
|
// This needs to be handled using delayed scheduled tasks instead
|
||||||
#endif
|
cSleep::MilliSleep(100);
|
||||||
|
|
||||||
m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7);
|
m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7);
|
||||||
}
|
}
|
||||||
@ -178,22 +176,23 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz )
|
|||||||
// These cannot be moved by the sticky piston, bail out
|
// These cannot be moved by the sticky piston, bail out
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
|
||||||
Sleep(100);
|
// TODO: This code needs replacing
|
||||||
#else
|
// Sleeping here will play the piston animation on the client; however, it will block the entire server
|
||||||
usleep(static_cast<useconds_t>(100)*1000);
|
// for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad
|
||||||
#endif
|
// This needs to be handled using delayed scheduled tasks instead
|
||||||
|
cSleep::MilliSleep(100);
|
||||||
|
|
||||||
m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta);
|
m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta);
|
||||||
m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0);
|
m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
// TODO: This code needs replacing
|
||||||
Sleep(100);
|
// Sleeping here will play the piston animation on the client; however, it will block the entire server
|
||||||
#else
|
// for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad
|
||||||
usleep(static_cast<useconds_t>(100)*1000);
|
// This needs to be handled using delayed scheduled tasks instead
|
||||||
#endif
|
cSleep::MilliSleep(100);
|
||||||
|
|
||||||
m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0);
|
m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user