summaryrefslogtreecommitdiffstats
path: root/source/UI
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/UI/SlotArea.cpp48
-rw-r--r--source/UI/SlotArea.h21
-rw-r--r--source/UI/Window.cpp15
-rw-r--r--source/UI/Window.h12
4 files changed, 96 insertions, 0 deletions
diff --git a/source/UI/SlotArea.cpp b/source/UI/SlotArea.cpp
index 4b6d237ba..01f77d74a 100644
--- a/source/UI/SlotArea.cpp
+++ b/source/UI/SlotArea.cpp
@@ -7,6 +7,7 @@
#include "SlotArea.h"
#include "../Player.h"
#include "../ChestEntity.h"
+#include "../DispenserEntity.h"
#include "../FurnaceEntity.h"
#include "../Items/ItemHandler.h"
#include "Window.h"
@@ -417,6 +418,53 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaFurnace:
+cSlotAreaDispenser::cSlotAreaDispenser(cDispenserEntity * a_Dispenser, cWindow & a_ParentWindow) :
+ cSlotArea(9, a_ParentWindow),
+ m_Dispenser(a_Dispenser)
+{
+}
+
+
+
+
+
+void cSlotAreaDispenser::Clicked(cPlayer & a_Player, int a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed, const cItem & a_ClickedItem)
+{
+ super::Clicked(a_Player, a_SlotNum, a_IsRightClick, a_IsShiftPressed, a_ClickedItem);
+
+ if (m_Dispenser == NULL)
+ {
+ LOGERROR("cSlotAreaDispenser::Clicked(): m_Dispenser == NULL");
+ ASSERT(!"cSlotAreaDispenser::Clicked(): m_Dispenser == NULL");
+ return;
+ }
+}
+
+
+
+
+
+const cItem * cSlotAreaDispenser::GetSlot(int a_SlotNum, cPlayer & a_Player)
+{
+ return m_Dispenser->GetSlot(a_SlotNum);
+}
+
+
+
+
+
+void cSlotAreaDispenser::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item)
+{
+ m_Dispenser->SetSlot(a_SlotNum, a_Item);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cSlotAreaFurnace:
+
cSlotAreaFurnace::cSlotAreaFurnace(cFurnaceEntity * a_Furnace, cWindow & a_ParentWindow) :
cSlotArea(3, a_ParentWindow),
m_Furnace(a_Furnace)
diff --git a/source/UI/SlotArea.h b/source/UI/SlotArea.h
index ffb8ed553..50c7e0c28 100644
--- a/source/UI/SlotArea.h
+++ b/source/UI/SlotArea.h
@@ -15,6 +15,7 @@
class cWindow;
class cPlayer;
class cChestEntity;
+class cDispenserEntity;
class cFurnaceEntity;
class cCraftingRecipe;
@@ -231,6 +232,26 @@ protected:
+class cSlotAreaDispenser :
+ public cSlotArea
+{
+ typedef cSlotArea super;
+
+public:
+ cSlotAreaDispenser(cDispenserEntity * a_Dispenser, cWindow & a_ParentWindow);
+
+ virtual void Clicked(cPlayer & a_Player, int a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed, const cItem & a_ClickedItem) override;
+ virtual const cItem * GetSlot(int a_SlotNum, cPlayer & a_Player) override;
+ virtual void SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item) override;
+
+protected:
+ cDispenserEntity * m_Dispenser;
+} ;
+
+
+
+
+
class cSlotAreaFurnace :
public cSlotArea
{
diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp
index dc5587390..7ad7b1a58 100644
--- a/source/UI/Window.cpp
+++ b/source/UI/Window.cpp
@@ -461,6 +461,21 @@ cChestWindow::~cChestWindow()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cDispenserWindow:
+
+cDispenserWindow::cDispenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserEntity * a_Dispenser) :
+ cWindow(cWindow::Dispenser, "MCS-Dispenser")
+{
+ m_SlotAreas.push_back(new cSlotAreaDispenser(a_Dispenser, *this));
+ m_SlotAreas.push_back(new cSlotAreaInventory(*this));
+ m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cFurnaceWindow:
cFurnaceWindow::cFurnaceWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceEntity * a_Furnace) :
diff --git a/source/UI/Window.h b/source/UI/Window.h
index a570ed480..f939727c9 100644
--- a/source/UI/Window.h
+++ b/source/UI/Window.h
@@ -19,6 +19,7 @@ class cPlayer;
class cWindowOwner;
class cClientHandle;
class cChestEntity;
+class cDispenserEntity;
class cFurnaceEntity;
class cSlotArea;
class cWorld;
@@ -148,6 +149,17 @@ public:
+class cDispenserWindow :
+ public cWindow
+{
+public:
+ cDispenserWindow(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserEntity * a_Dispenser);
+} ;
+
+
+
+
+
class cChestWindow :
public cWindow
{