diff options
Diffstat (limited to '')
-rw-r--r-- | source/UI/Window.cpp | 41 | ||||
-rw-r--r-- | source/UI/Window.h | 3 |
2 files changed, 34 insertions, 10 deletions
diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp index 0c955ba57..dc5587390 100644 --- a/source/UI/Window.cpp +++ b/source/UI/Window.cpp @@ -155,8 +155,6 @@ void cWindow::OpenedByPlayer(cPlayer & a_Player) } // for itr - m_SlotAreas[] } - // TODO: Notify all areas that a new player has opened the window - a_Player.GetClientHandle()->SendWindowOpen(m_WindowID, m_WindowType, m_WindowTitle, GetNumSlots() - c_NumInventorySlots); } @@ -405,20 +403,43 @@ cCraftingWindow::cCraftingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) : /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cChestWindow: -cChestWindow::cChestWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cChestEntity * a_Chest) : - cWindow(cWindow::Chest, "MCS-Chest"), +cChestWindow::cChestWindow(cChestEntity * a_Chest) : + cWindow(cWindow::Chest, "MCS-SingleChest"), m_World(a_Chest->GetWorld()), - m_BlockX(a_BlockX), - m_BlockY(a_BlockY), - m_BlockZ(a_BlockZ) + m_BlockX(a_Chest->GetPosX()), + m_BlockY(a_Chest->GetPosY()), + m_BlockZ(a_Chest->GetPosZ()) { m_SlotAreas.push_back(new cSlotAreaChest(a_Chest, *this)); + m_SlotAreas.push_back(new cSlotAreaInventory(*this)); + m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); - // TODO: Double chests - + // Play the opening sound: + m_World->BroadcastSoundEffect("random.chestopen", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1); + + // Send out the chest-open packet: + m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_CHEST); +} + + + + + +cChestWindow::cChestWindow(cChestEntity * a_PrimaryChest, cChestEntity * a_SecondaryChest) : + cWindow(cWindow::Chest, "MCS-DoubleChest"), + m_World(a_PrimaryChest->GetWorld()), + m_BlockX(a_PrimaryChest->GetPosX()), + m_BlockY(a_PrimaryChest->GetPosY()), + m_BlockZ(a_PrimaryChest->GetPosZ()) +{ + m_SlotAreas.push_back(new cSlotAreaChest(a_PrimaryChest, *this)); + m_SlotAreas.push_back(new cSlotAreaChest(a_SecondaryChest, *this)); m_SlotAreas.push_back(new cSlotAreaInventory(*this)); m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); + // Play the opening sound: + m_World->BroadcastSoundEffect("random.chestopen", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1); + // Send out the chest-open packet: m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 1, E_BLOCK_CHEST); } @@ -431,6 +452,8 @@ cChestWindow::~cChestWindow() { // Send out the chest-close packet: m_World->BroadcastBlockAction(m_BlockX, m_BlockY, m_BlockZ, 1, 0, E_BLOCK_CHEST); + + m_World->BroadcastSoundEffect("random.chestclosed", m_BlockX * 8, m_BlockY * 8, m_BlockZ * 8, 1, 1); } diff --git a/source/UI/Window.h b/source/UI/Window.h index 8caab3bd1..a570ed480 100644 --- a/source/UI/Window.h +++ b/source/UI/Window.h @@ -152,7 +152,8 @@ class cChestWindow : public cWindow { public: - cChestWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cChestEntity * a_Chest); + cChestWindow(cChestEntity * a_Chest); + cChestWindow(cChestEntity * a_PrimaryChest, cChestEntity * a_SecondaryChest); ~cChestWindow(); protected: |