summaryrefslogtreecommitdiffstats
path: root/source/UI/SlotArea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/UI/SlotArea.cpp')
-rw-r--r--source/UI/SlotArea.cpp61
1 files changed, 20 insertions, 41 deletions
diff --git a/source/UI/SlotArea.cpp b/source/UI/SlotArea.cpp
index feeeb4add..fc3f248f5 100644
--- a/source/UI/SlotArea.cpp
+++ b/source/UI/SlotArea.cpp
@@ -475,43 +475,22 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cSlotAreaDropSpenser:
-
-cSlotAreaDropSpenser::cSlotAreaDropSpenser(cDropSpenserEntity * a_DropSpenser, cWindow & a_ParentWindow) :
- cSlotArea(9, a_ParentWindow),
- m_DropSpenser(a_DropSpenser)
-{
-}
-
-
-
-
-
-const cItem * cSlotAreaDropSpenser::GetSlot(int a_SlotNum, cPlayer & a_Player) const
-{
- return &(m_DropSpenser->GetSlot(a_SlotNum));
-}
-
-
-
-
+// cSlotAreaFurnace:
-void cSlotAreaDropSpenser::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem & a_Item)
+cSlotAreaFurnace::cSlotAreaFurnace(cFurnaceEntity * a_Furnace, cWindow & a_ParentWindow) :
+ cSlotArea(3, a_ParentWindow),
+ m_Furnace(a_Furnace)
{
- m_DropSpenser->SetSlot(a_SlotNum, a_Item);
+ m_Furnace->GetContents().AddListener(*this);
}
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cSlotAreaFurnace:
-
-cSlotAreaFurnace::cSlotAreaFurnace(cFurnaceEntity * a_Furnace, cWindow & a_ParentWindow) :
- cSlotArea(3, a_ParentWindow),
- m_Furnace(a_Furnace)
+cSlotAreaFurnace::~cSlotAreaFurnace()
{
+ m_Furnace->GetContents().RemoveListener(*this);
}
@@ -520,8 +499,6 @@ cSlotAreaFurnace::cSlotAreaFurnace(cFurnaceEntity * a_Furnace, cWindow & a_Paren
void cSlotAreaFurnace::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem)
{
- cItem Fuel = *GetSlot(0, a_Player);
-
super::Clicked(a_Player, a_SlotNum, a_ClickAction, a_ClickedItem);
if (m_Furnace == NULL)
@@ -530,16 +507,6 @@ void cSlotAreaFurnace::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a
ASSERT(!"cSlotAreaFurnace::Clicked(): m_Furnace == NULL");
return;
}
-
- if (Fuel.m_ItemType != GetSlot(0, a_Player)->m_ItemType)
- {
- m_Furnace->ResetCookTimer();
- }
-
- if (m_Furnace->StartCooking())
- {
- m_ParentWindow.SendWholeWindow(*(a_Player.GetClientHandle()));
- }
}
@@ -549,7 +516,7 @@ void cSlotAreaFurnace::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a
const cItem * cSlotAreaFurnace::GetSlot(int a_SlotNum, cPlayer & a_Player) const
{
// a_SlotNum ranges from 0 to 2, query the items from the underlying furnace:
- return m_Furnace->GetSlot(a_SlotNum);
+ return &(m_Furnace->GetSlot(a_SlotNum));
}
@@ -565,6 +532,18 @@ void cSlotAreaFurnace::SetSlot(int a_SlotNum, cPlayer & a_Player, const cItem &
+void cSlotAreaFurnace::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
+{
+ // Something has changed in the window, broadcast the entire window to all clients
+ ASSERT(a_ItemGrid == &(m_Furnace->GetContents()));
+
+ m_ParentWindow.BroadcastWholeWindow();
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaInventoryBase: