1
0

Added more rail functionality

This commit is contained in:
Tiger Wang 2014-01-19 14:52:45 +00:00
parent 82b2290b74
commit 8467f5dfae
3 changed files with 22 additions and 18 deletions

View File

@ -204,7 +204,7 @@ public:
bool IsUnstable(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) bool IsUnstable(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
{ {
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_RAIL) if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
{ {
return false; return false;
} }
@ -339,11 +339,11 @@ public:
{ {
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false); AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
NIBBLETYPE Meta; NIBBLETYPE Meta;
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_RAIL) if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
{ {
if ((a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ) != E_BLOCK_RAIL) || (a_Pure != E_PURE_UPDOWN)) if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)) || (a_Pure != E_PURE_UPDOWN))
{ {
if ((a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) != E_BLOCK_RAIL) || (a_Pure == E_PURE_NONE)) if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)) || (a_Pure == E_PURE_NONE))
{ {
return true; return true;
} }

View File

@ -282,6 +282,24 @@ inline bool IsBlockLiquid(BLOCKTYPE a_BlockType)
inline bool IsBlockRail(BLOCKTYPE a_BlockType)
{
switch (a_BlockType)
{
case E_BLOCK_RAIL:
case E_BLOCK_ACTIVATOR_RAIL:
case E_BLOCK_DETECTOR_RAIL:
case E_BLOCK_POWERED_RAIL:
{
return true;
}
default: return false;
}
}
inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType) inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType)
{ {

View File

@ -15,20 +15,6 @@
inline bool IsBlockRail(BLOCKTYPE a_BlockType)
{
return (
(a_BlockType == E_BLOCK_RAIL) ||
(a_BlockType == E_BLOCK_ACTIVATOR_RAIL) ||
(a_BlockType == E_BLOCK_DETECTOR_RAIL) ||
(a_BlockType == E_BLOCK_POWERED_RAIL)
) ;
}
class cMinecart : class cMinecart :
public cEntity public cEntity
{ {