summaryrefslogtreecommitdiffstats
path: root/src/UI/Window.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-09-02 21:38:37 +0200
committerMattes D <github@xoft.cz>2014-09-02 21:38:37 +0200
commit82f203714677a7ae45804393853c3591c628e864 (patch)
treeea87cb927f0448e2960dff6d1763777942500213 /src/UI/Window.cpp
parentRe-added alternate spellings of darkgraywool. (diff)
parentChanged the IsEnchantable() comment again. (diff)
downloadcuberite-82f203714677a7ae45804393853c3591c628e864.tar
cuberite-82f203714677a7ae45804393853c3591c628e864.tar.gz
cuberite-82f203714677a7ae45804393853c3591c628e864.tar.bz2
cuberite-82f203714677a7ae45804393853c3591c628e864.tar.lz
cuberite-82f203714677a7ae45804393853c3591c628e864.tar.xz
cuberite-82f203714677a7ae45804393853c3591c628e864.tar.zst
cuberite-82f203714677a7ae45804393853c3591c628e864.zip
Diffstat (limited to 'src/UI/Window.cpp')
-rw-r--r--src/UI/Window.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index 8f4913030..66900269f 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -881,7 +881,7 @@ cEnchantingWindow::cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) :
m_BlockY(a_BlockY),
m_BlockZ(a_BlockZ)
{
- m_SlotAreas.push_back(new cSlotAreaEnchanting(*this));
+ m_SlotAreas.push_back(new cSlotAreaEnchanting(*this, m_BlockX, m_BlockY, m_BlockZ));
m_SlotAreas.push_back(new cSlotAreaInventory(*this));
m_SlotAreas.push_back(new cSlotAreaHotBar(*this));
}
@@ -892,8 +892,13 @@ cEnchantingWindow::cEnchantingWindow(int a_BlockX, int a_BlockY, int a_BlockZ) :
void cEnchantingWindow::SetProperty(int a_Property, int a_Value)
{
- m_PropertyValue[a_Property] = a_Value;
+ if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ {
+ ASSERT(!"a_Property is invalid");
+ return;
+ }
+ m_PropertyValue[a_Property] = a_Value;
super::SetProperty(a_Property, a_Value);
}
@@ -903,8 +908,13 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value)
void cEnchantingWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Player)
{
- m_PropertyValue[a_Property] = a_Value;
+ if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ {
+ ASSERT(!"a_Property is invalid");
+ return;
+ }
+ m_PropertyValue[a_Property] = a_Value;
super::SetProperty(a_Property, a_Value, a_Player);
}
@@ -914,18 +924,13 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Pla
int cEnchantingWindow::GetPropertyValue(int a_Property)
{
- return m_PropertyValue[a_Property];
-}
-
-
-
-
+ if ((a_Property < 0) || ((size_t)a_Property >= ARRAYCOUNT(m_PropertyValue)))
+ {
+ ASSERT(!"a_Property is invalid");
+ return 0;
+ }
-void cEnchantingWindow::GetBlockPos(int & a_PosX, int & a_PosY, int & a_PosZ)
-{
- a_PosX = m_BlockX;
- a_PosY = m_BlockY;
- a_PosZ = m_BlockZ;
+ return m_PropertyValue[a_Property];
}