diff options
Diffstat (limited to 'src/UI/EnchantingWindow.cpp')
-rw-r--r-- | src/UI/EnchantingWindow.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/UI/EnchantingWindow.cpp b/src/UI/EnchantingWindow.cpp index 4ce4bebb3..15d27fc63 100644 --- a/src/UI/EnchantingWindow.cpp +++ b/src/UI/EnchantingWindow.cpp @@ -28,13 +28,12 @@ cEnchantingWindow::cEnchantingWindow(Vector3i a_BlockPos, const AString & a_Titl void cEnchantingWindow::SetProperty(short a_Property, short a_Value, cPlayer & a_Player) { - if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue))) + ASSERT(a_Property >= 0); + if (static_cast<size_t>(a_Property) < m_PropertyValue.size()) { - ASSERT(!"a_Property is invalid"); - return; + m_PropertyValue[a_Property] = a_Value; } - m_PropertyValue[a_Property] = a_Value; Super::SetProperty(a_Property, a_Value, a_Player); } @@ -44,13 +43,12 @@ void cEnchantingWindow::SetProperty(short a_Property, short a_Value, cPlayer & a void cEnchantingWindow::SetProperty(short a_Property, short a_Value) { - if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue))) + ASSERT(a_Property >= 0); + if (static_cast<size_t>(a_Property) < m_PropertyValue.size()) { - ASSERT(!"a_Property is invalid"); - return; + m_PropertyValue[a_Property] = a_Value; } - m_PropertyValue[a_Property] = a_Value; Super::SetProperty(a_Property, a_Value); } @@ -58,9 +56,9 @@ void cEnchantingWindow::SetProperty(short a_Property, short a_Value) -short cEnchantingWindow::GetPropertyValue(short a_Property) +short cEnchantingWindow::GetProperty(short a_Property) { - if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= ARRAYCOUNT(m_PropertyValue))) + if ((a_Property < 0) || (static_cast<size_t>(a_Property) >= m_PropertyValue.size())) { ASSERT(!"a_Property is invalid"); return 0; |