summaryrefslogtreecommitdiffstats
path: root/src/UI/SlotArea.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-05-12 16:05:09 +0200
committerandrew <xdotftw@gmail.com>2014-05-12 16:05:09 +0200
commitb3d2b5b2c94193fd9364b26293b7d96b748ff96d (patch)
tree215519ba96caea0269641209452661b8bd6e14da /src/UI/SlotArea.cpp
parentFixed compilation (diff)
downloadcuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar.gz
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar.bz2
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar.lz
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar.xz
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.tar.zst
cuberite-b3d2b5b2c94193fd9364b26293b7d96b748ff96d.zip
Diffstat (limited to 'src/UI/SlotArea.cpp')
-rw-r--r--src/UI/SlotArea.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 788974f9c..1e3d8eaa4 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -496,6 +496,8 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
DraggingItem = Result;
Recipe.ConsumeIngredients(Grid);
Grid.CopyToItems(PlayerSlots);
+
+ HandleCraftItem(Result, a_Player);
}
else if (DraggingItem.IsEqual(Result))
{
@@ -505,6 +507,8 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
DraggingItem.m_ItemCount += Result.m_ItemCount;
Recipe.ConsumeIngredients(Grid);
Grid.CopyToItems(PlayerSlots);
+
+ HandleCraftItem(Result, a_Player);
}
}
@@ -594,6 +598,27 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
+void cSlotAreaCrafting::HandleCraftItem(const cItem & a_Result, cPlayer & a_Player)
+{
+ switch (a_Result.m_ItemType)
+ {
+ case E_BLOCK_WORKBENCH: a_Player.AwardAchievement(achCraftWorkbench); break;
+ case E_BLOCK_FURNACE: a_Player.AwardAchievement(achCraftFurnace); break;
+ case E_BLOCK_CAKE: a_Player.AwardAchievement(achBakeCake); break;
+ case E_BLOCK_ENCHANTMENT_TABLE: a_Player.AwardAchievement(achCraftEnchantTable); break;
+ case E_BLOCK_BOOKCASE: a_Player.AwardAchievement(achBookshelf); break;
+ case E_ITEM_WOODEN_PICKAXE: a_Player.AwardAchievement(achCraftPickaxe); break;
+ case E_ITEM_WOODEN_SWORD: a_Player.AwardAchievement(achCraftSword); break;
+ case E_ITEM_STONE_PICKAXE: a_Player.AwardAchievement(achCraftBetterPick); break;
+ case E_ITEM_WOODEN_HOE: a_Player.AwardAchievement(achCraftHoe); break;
+ case E_ITEM_BREAD: a_Player.AwardAchievement(achMakeBread); break;
+ default: break;
+ }
+}
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaAnvil:
@@ -1393,7 +1418,7 @@ 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();
}
@@ -1401,6 +1426,21 @@ void cSlotAreaFurnace::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
+void cSlotAreaFurnace::HandleSmeltItem(const cItem & a_Result, cPlayer & a_Player)
+{
+ /** TODO 2014-05-12 xdot: Figure out when to call this method. */
+ switch (a_Result.m_ItemType)
+ {
+ case E_ITEM_IRON: a_Player.AwardAchievement(achAcquireIron); break;
+ case E_ITEM_COOKED_FISH: a_Player.AwardAchievement(achCookFish); break;
+ default: break;
+ }
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaInventoryBase: