summaryrefslogtreecommitdiffstats
path: root/src/UI
diff options
context:
space:
mode:
Diffstat (limited to 'src/UI')
-rw-r--r--src/UI/SlotArea.cpp10
-rw-r--r--src/UI/SlotArea.h2
-rw-r--r--src/UI/Window.cpp3
-rw-r--r--src/UI/Window.h9
4 files changed, 16 insertions, 8 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index eac8257ec..2941982a7 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -600,8 +600,7 @@ cCraftingRecipe & cSlotAreaCrafting::GetRecipeForPlayer(cPlayer & a_Player)
cSlotAreaAnvil::cSlotAreaAnvil(cAnvilWindow & a_ParentWindow) :
cSlotAreaTemporary(3, a_ParentWindow),
- m_MaximumCost(0),
- m_RepairedItemName("")
+ m_MaximumCost(0)
{
}
@@ -705,7 +704,8 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
}
int NameChangeExp = 0;
- if (m_RepairedItemName.empty())
+ const AString & RepairedItemName = ((cAnvilWindow*)&m_ParentWindow)->GetRepairedItemName();
+ if (RepairedItemName.empty())
{
// Remove custom name
if (!Input.m_CustomName.empty())
@@ -715,7 +715,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
Input.m_CustomName = "";
}
}
- else if (m_RepairedItemName != Input.m_CustomName)
+ else if (RepairedItemName != Input.m_CustomName)
{
// Change custom name
NameChangeExp = (Input.IsDamageable()) ? 4 : (Input.m_ItemCount * 5);
@@ -726,7 +726,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player)
RepairCost += NameChangeExp / 2;
}
- Input.m_CustomName = m_RepairedItemName;
+ Input.m_CustomName = RepairedItemName;
}
// TODO: Add enchantment exp cost.
diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h
index a316480c6..01dcb88ab 100644
--- a/src/UI/SlotArea.h
+++ b/src/UI/SlotArea.h
@@ -280,8 +280,6 @@ protected:
/** The maximum cost of repairing/renaming in the anvil. */
int m_MaximumCost;
-
- AString m_RepairedItemName;
} ;
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index eb105f8ab..d6adbef8f 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -808,7 +808,8 @@ cCraftingWindow::cCraftingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) :
// cAnvilWindow:
cAnvilWindow::cAnvilWindow() :
- cWindow(wtAnvil, "Repair")
+ cWindow(wtAnvil, "Repair"),
+ m_RepairedItemName("")
{
m_SlotAreas.push_back(new cSlotAreaAnvil(*this));
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
diff --git a/src/UI/Window.h b/src/UI/Window.h
index c08b36f9b..8f6f80a41 100644
--- a/src/UI/Window.h
+++ b/src/UI/Window.h
@@ -237,6 +237,15 @@ class cAnvilWindow :
typedef cWindow super;
public:
cAnvilWindow();
+
+ /** Gets the repaired item name. */
+ AString GetRepairedItemName(void) const { return m_RepairedItemName; }
+
+ /** Set the repaired item name. */
+ void SetRepairedItemName(const AString & a_Name) { m_RepairedItemName = a_Name; }
+
+protected:
+ AString m_RepairedItemName;
} ;