diff options
author | andrew <xdotftw@gmail.com> | 2014-01-18 20:27:54 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-18 20:27:54 +0100 |
commit | a037172465932de7d0d7d725c3c8ec5b2fa44029 (patch) | |
tree | e59a7444acc471f4cd2e5e834212a2756b97d4ea /src | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
download | cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.gz cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.bz2 cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.lz cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.xz cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.tar.zst cuberite-a037172465932de7d0d7d725c3c8ec5b2fa44029.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.cpp | 36 | ||||
-rw-r--r-- | src/BlockEntities/CommandBlockEntity.h | 7 | ||||
-rw-r--r-- | src/ClientHandle.cpp | 17 |
3 files changed, 17 insertions, 43 deletions
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp index c29e3dff8..543d47b7a 100644 --- a/src/BlockEntities/CommandBlockEntity.cpp +++ b/src/BlockEntities/CommandBlockEntity.cpp @@ -20,24 +20,7 @@ cCommandBlockEntity::cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_W super(E_BLOCK_COMMAND_BLOCK, a_X, a_Y, a_Z, a_World), m_ShouldExecute(false), m_IsPowered(false) -{ - SetBlockEntity(this); // cBlockEntityWindowOwner -} - - - - - - -cCommandBlockEntity::~cCommandBlockEntity() -{ - // Tell window its owner is destroyed - cWindow * Window = GetWindow(); - if (Window != NULL) - { - Window->OwnerDestroyed(); - } -} +{} @@ -46,21 +29,8 @@ cCommandBlockEntity::~cCommandBlockEntity() void cCommandBlockEntity::UsedBy(cPlayer * a_Player) { - cWindow * Window = GetWindow(); - if (Window == NULL) - { - // TODO 2014-01-18 xdot: Open the appropriate window. - // OpenWindow(new cCommandBlockWindow(m_PosX, m_PosY, m_PosZ, this)); - Window = GetWindow(); - } - - if (Window != NULL) - { - if (a_Player->GetWindow() != Window) - { - a_Player->OpenWindow(Window); - } - } + // Nothing to do + UNUSED(a_Player); } diff --git a/src/BlockEntities/CommandBlockEntity.h b/src/BlockEntities/CommandBlockEntity.h index c4529a1e6..12157670f 100644 --- a/src/BlockEntities/CommandBlockEntity.h +++ b/src/BlockEntities/CommandBlockEntity.h @@ -9,8 +9,7 @@ #pragma once -#include "BlockEntityWithItems.h" -#include "../UI/WindowOwner.h" +#include "BlockEntity.h" @@ -28,8 +27,7 @@ namespace Json // tolua_begin class cCommandBlockEntity : - public cBlockEntity, - public cBlockEntityWindowOwner + public cBlockEntity { typedef cBlockEntity super; @@ -39,7 +37,6 @@ public: /// Creates a new empty command block entity cCommandBlockEntity(int a_X, int a_Y, int a_Z, cWorld * a_World); - virtual ~cCommandBlockEntity(); bool LoadFromJson( const Json::Value& a_Value ); virtual void SaveToJson(Json::Value& a_Value ) override; diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 0a97ba6c8..faf583fbb 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -570,19 +570,26 @@ void cClientHandle::HandleCommandBlockMessage(const char* a_Data, unsigned int a return; } + cByteBuffer Buffer(a_Length); + Buffer.Write(a_Data, a_Length); + int BlockX, BlockY, BlockZ; AString Command; - switch (a_Data[0]) + char Mode; + + Buffer.ReadChar(Mode); + + switch (Mode) { case 0x00: { - BlockX = GetBEInt(a_Data + 1); - BlockY = GetBEInt(a_Data + 5); - BlockZ = GetBEInt(a_Data + 9); + Buffer.ReadBEInt(BlockX); + Buffer.ReadBEInt(BlockY); + Buffer.ReadBEInt(BlockZ); - Command = AString(a_Data + 14, (int)a_Data[13]); + Buffer.ReadVarUTF8String(Command); break; } |