diff options
author | Hownaer <franzi.moos@googlemail.com> | 2014-08-28 01:21:54 +0200 |
---|---|---|
committer | Hownaer <franzi.moos@googlemail.com> | 2014-08-28 01:21:54 +0200 |
commit | 0f1fd3312332da2a6104c9eb98625610a4a08eff (patch) | |
tree | da0e5d5f4d98b99e56090477c0da87faeef1ebf4 /src/UI/Window.cpp | |
parent | Fixed ItemCategory code example. (diff) | |
download | cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar.gz cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar.bz2 cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar.lz cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar.xz cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.tar.zst cuberite-0f1fd3312332da2a6104c9eb98625610a4a08eff.zip |
Diffstat (limited to 'src/UI/Window.cpp')
-rw-r--r-- | src/UI/Window.cpp | 33 |
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]; } |