summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockDoor.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-02-01 00:17:41 +0100
committerTycho <work.tycho+git@gmail.com>2014-02-01 00:17:41 +0100
commit25ec7750aac9800bec83a844020a6eeda5cd4d74 (patch)
tree1820a0856969583238d85b2a68d299e55807f951 /src/Blocks/BlockDoor.cpp
parentChanged it so std was actually set to c++11 in clang not gcc on OS X (diff)
downloadcuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar.gz
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar.bz2
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar.lz
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar.xz
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.tar.zst
cuberite-25ec7750aac9800bec83a844020a6eeda5cd4d74.zip
Diffstat (limited to 'src/Blocks/BlockDoor.cpp')
-rw-r--r--src/Blocks/BlockDoor.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp
index 20b0a6324..971784d0c 100644
--- a/src/Blocks/BlockDoor.cpp
+++ b/src/Blocks/BlockDoor.cpp
@@ -2,7 +2,6 @@
#include "Globals.h"
#include "BlockDoor.h"
#include "../Item.h"
-#include "../World.h"
#include "../Entities/Player.h"
@@ -18,24 +17,24 @@ cBlockDoorHandler::cBlockDoorHandler(BLOCKTYPE a_BlockType)
-void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
+void cBlockDoorHandler::OnDestroyed(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
{
- NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
+ NIBBLETYPE OldMeta = a_ChunkInterface->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (OldMeta & 8)
{
// Was upper part of door
- if (IsDoor(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
+ if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)))
{
- a_World->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
+ a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0);
}
}
else
{
// Was lower part
- if (IsDoor(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
+ if (IsDoor(a_ChunkInterface->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)))
{
- a_World->FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0);
+ a_ChunkInterface->FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0);
}
}
}
@@ -44,11 +43,11 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY
-void cBlockDoorHandler::OnUse(cWorld * a_World, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
+void cBlockDoorHandler::OnUse(cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ)
{
- if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
+ if (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_WOODEN_DOOR)
{
- ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ);
+ ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
}
}
@@ -57,7 +56,7 @@ void cBlockDoorHandler::OnUse(cWorld * a_World, cWorldInterface * a_WorldInterfa
void cBlockDoorHandler::OnPlacedByPlayer(
- cWorld * a_World, cPlayer * a_Player,
+ cChunkInterface * a_ChunkInterface, cWorldInterface * a_WorldInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
int a_CursorX, int a_CursorY, int a_CursorZ,
BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta
@@ -65,15 +64,15 @@ void cBlockDoorHandler::OnPlacedByPlayer(
{
NIBBLETYPE a_TopBlockMeta = 8;
if (
- ((a_BlockMeta == 0) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
- ((a_BlockMeta == 1) && (a_World->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
- ((a_BlockMeta == 2) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
- ((a_BlockMeta == 3) && (a_World->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
+ ((a_BlockMeta == 0) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) ||
+ ((a_BlockMeta == 1) && (a_ChunkInterface->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) ||
+ ((a_BlockMeta == 2) && (a_ChunkInterface->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) ||
+ ((a_BlockMeta == 3) && (a_ChunkInterface->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType))
)
{
a_TopBlockMeta = 9;
}
- a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta);
+ a_ChunkInterface->SetBlock(a_WorldInterface, a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta);
}