diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-06 22:10:16 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-06 22:10:16 +0200 |
commit | e8366993ce3f1cc0c2c6cde1d133773d1f23c474 (patch) | |
tree | 789fd452065ff6aa68f2ceac5664959bdb24afc0 /source/cPlayer.cpp | |
parent | Added the Doxygen configuration file (diff) | |
download | cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar.gz cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar.bz2 cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar.lz cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar.xz cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.tar.zst cuberite-e8366993ce3f1cc0c2c6cde1d133773d1f23c474.zip |
Diffstat (limited to 'source/cPlayer.cpp')
-rw-r--r-- | source/cPlayer.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index b7b7919fd..c260330f6 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -460,7 +460,7 @@ void cPlayer::CloseWindow(char a_WindowType) (m_Inventory->GetWindow()->GetDraggingItem()->m_ItemCount > 0) ) { - LOG("Player holds item! Dropping it..."); + LOGD("Player holds item! Dropping it..."); TossItem( true, m_Inventory->GetWindow()->GetDraggingItem()->m_ItemCount ); } @@ -481,17 +481,18 @@ void cPlayer::CloseWindow(char a_WindowType) m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY() + 1.6f, GetPosZ(), vX * 2, vY * 2, vZ * 2); } - if (m_CurrentWindow) + if (m_CurrentWindow != NULL) { // FIXME: If the player entity is destroyed while having a chest window open, the chest will not close - if (a_WindowType == 1 && strcmp(m_CurrentWindow->GetWindowTitle().c_str(), "UberChest") == 0) { // Chest - cBlockEntity *block = m_CurrentWindow->GetOwner()->GetEntity(); + if ((a_WindowType == 1) && (m_CurrentWindow->GetWindowType() == cWindow::Chest)) + { + // Chest cPacket_BlockAction ChestClose; - ChestClose.m_PosX = block->GetPosX(); - ChestClose.m_PosY = (short)block->GetPosY(); - ChestClose.m_PosZ = block->GetPosZ(); - ChestClose.m_Byte1 = 1; - ChestClose.m_Byte2 = 0; + int y = 0; + m_CurrentWindow->GetOwner()->GetBlockPos(ChestClose.m_PosX, y, ChestClose.m_PosZ); + ChestClose.m_PosY = (short)y; + ChestClose.m_Byte1 = 1; // Unused, always 1 + ChestClose.m_Byte2 = 0; // 0 = closed m_World->Broadcast(ChestClose); } |