From f6ae6002c3db2535a9858cf88537845245e6e7ba Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Sun, 19 Aug 2012 10:44:19 +0000 Subject: Fixed Bug #236 Workbench, Chest and Furnace are usable again git-svn-id: http://mc-server.googlecode.com/svn/trunk@755 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/blocks/Block.cpp | 7 ++++++- source/blocks/Block.h | 3 ++- source/blocks/BlockDoor.cpp | 7 ++++++- source/blocks/BlockDoor.h | 3 ++- source/blocks/BlockEntity.h | 2 +- source/blocks/BlockFire.h | 2 +- source/blocks/BlockRedstoneRepeater.cpp | 7 ++++++- source/blocks/BlockRedstoneRepeater.h | 3 ++- source/blocks/BlockWorkbench.h | 2 +- source/cClientHandle.cpp | 6 +++--- 10 files changed, 30 insertions(+), 12 deletions(-) diff --git a/source/blocks/Block.cpp b/source/blocks/Block.cpp index 215a6c618..6bd984d8d 100644 --- a/source/blocks/Block.cpp +++ b/source/blocks/Block.cpp @@ -222,7 +222,12 @@ void cBlockHandler::OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z } -void cBlockHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +void cBlockHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +{ + +} + +void cBlockHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) { } diff --git a/source/blocks/Block.h b/source/blocks/Block.h index 50c541551..2683cc3b5 100644 --- a/source/blocks/Block.h +++ b/source/blocks/Block.h @@ -18,7 +18,8 @@ public: virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z); virtual void OnNeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); static void NeighborChanged(cWorld *a_World, int a_X, int a_Y, int a_Z); - virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); + virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); + virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z); virtual void PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir); virtual int GetTickRate(); diff --git a/source/blocks/BlockDoor.cpp b/source/blocks/BlockDoor.cpp index 3fc804704..ecee2c12d 100644 --- a/source/blocks/BlockDoor.cpp +++ b/source/blocks/BlockDoor.cpp @@ -38,7 +38,12 @@ void cBlockDoorHandler::OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) } } -void cBlockDoorHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +void cBlockDoorHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +{ + cDoors::ChangeDoor(a_World, a_X, a_Y, a_Z); +} + +void cBlockDoorHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) { cDoors::ChangeDoor(a_World, a_X, a_Y, a_Z); } diff --git a/source/blocks/BlockDoor.h b/source/blocks/BlockDoor.h index ccf7dd4a7..0ccc3fdac 100644 --- a/source/blocks/BlockDoor.h +++ b/source/blocks/BlockDoor.h @@ -8,7 +8,8 @@ public: cBlockDoorHandler(BLOCKTYPE a_BlockID); virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override; virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override; - virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; + virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; + virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; virtual char GetDropCount() override; virtual bool IsUseable() override { diff --git a/source/blocks/BlockEntity.h b/source/blocks/BlockEntity.h index 085b65158..bfc3241d3 100644 --- a/source/blocks/BlockEntity.h +++ b/source/blocks/BlockEntity.h @@ -15,7 +15,7 @@ public: { } - virtual void OnClick(cWorld * a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override + virtual void OnUse(cWorld * a_World, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override { a_World->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); } diff --git a/source/blocks/BlockFire.h b/source/blocks/BlockFire.h index f1563c637..3e605636b 100644 --- a/source/blocks/BlockFire.h +++ b/source/blocks/BlockFire.h @@ -10,7 +10,7 @@ public: { } - virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override + virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override { a_World->DigBlock(a_X, a_Y, a_Z); } diff --git a/source/blocks/BlockRedstoneRepeater.cpp b/source/blocks/BlockRedstoneRepeater.cpp index 79214069a..4921cd6f7 100644 --- a/source/blocks/BlockRedstoneRepeater.cpp +++ b/source/blocks/BlockRedstoneRepeater.cpp @@ -22,11 +22,16 @@ void cBlockRedstoneRepeaterHandler::OnDestroyed(cWorld *a_World, int a_X, int a_ Redstone.ChangeRedstone(a_X, a_Y, a_Z, false); } -void cBlockRedstoneRepeaterHandler::OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +void cBlockRedstoneRepeaterHandler::OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) { a_World->FastSetBlock(a_X, a_Y, a_Z, m_BlockID, ((a_World->GetBlockMeta(a_X, a_Y, a_Z) + 0x04) & 0x0f)); } +void cBlockRedstoneRepeaterHandler::OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) +{ + OnUse(a_World, a_Player, a_X, a_Y, a_Z); +} + void cBlockRedstoneRepeaterHandler::PlaceBlock(cWorld *a_World, cPlayer *a_Player, NIBBLETYPE a_BlockMeta, int a_X, int a_Y, int a_Z, char a_Dir) { a_World->SetBlock(a_X, a_Y, a_Z, m_BlockID, cRedstone::RepeaterRotationToMetaData(a_Player->GetRotation())); diff --git a/source/blocks/BlockRedstoneRepeater.h b/source/blocks/BlockRedstoneRepeater.h index 4b6b60485..26b2b9877 100644 --- a/source/blocks/BlockRedstoneRepeater.h +++ b/source/blocks/BlockRedstoneRepeater.h @@ -9,7 +9,8 @@ public: virtual void OnPlaced(cWorld *a_World, int a_X, int a_Y, int a_Z, int a_Dir) override; virtual void OnDestroyed(cWorld *a_World, int a_X, int a_Y, int a_Z) override; - virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; + virtual void OnDigging(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; + virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override; virtual NIBBLETYPE GetDropMeta(NIBBLETYPE a_BlockMeta) override { diff --git a/source/blocks/BlockWorkbench.h b/source/blocks/BlockWorkbench.h index d654ca666..52c3ad738 100644 --- a/source/blocks/BlockWorkbench.h +++ b/source/blocks/BlockWorkbench.h @@ -11,7 +11,7 @@ public: { } - virtual void OnClick(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override + virtual void OnUse(cWorld *a_World, cPlayer *a_Player, int a_X, int a_Y, int a_Z) override { cWindow* Window = new cCraftingWindow(0, true); a_Player->OpenWindow(Window); diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index a2629133f..ad2fa7857 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -878,7 +878,7 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha else { cBlockHandler * Handler = cBlockHandler::GetBlockHandler(OldBlock); - Handler->OnClick(World, m_Player, a_BlockX, a_BlockY, a_BlockZ); + Handler->OnDigging(World, m_Player, a_BlockX, a_BlockY, a_BlockZ); ItemHandler->OnDiggingBlock(World, m_Player, &Equipped, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); @@ -892,7 +892,7 @@ void cClientHandle::HandleBlockDig(int a_BlockX, int a_BlockY, int a_BlockZ, cha Handler = cBlockHandler::GetBlockHandler(World->GetBlock(pX, pY, pZ)); if (Handler->IsClickedThrough()) { - Handler->OnClick(World, m_Player, pX, pY, pZ); + Handler->OnDigging(World, m_Player, pX, pY, pZ); } } } @@ -940,7 +940,7 @@ void cClientHandle::HandleBlockPlace(int a_BlockX, int a_BlockY, int a_BlockZ, c cBlockHandler *Handler = cBlockHandler::GetBlockHandler(World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)); if (Handler->IsUseable()) { - Handler->OnClick(World, m_Player, a_BlockX, a_BlockY, a_BlockZ); + Handler->OnUse(World, m_Player, a_BlockX, a_BlockY, a_BlockZ); } else { -- cgit v1.2.3