summaryrefslogtreecommitdiffstats
path: root/src/UI/EnchantingWindow.cpp
diff options
context:
space:
mode:
authorKingCol13 <48412633+KingCol13@users.noreply.github.com>2020-10-01 23:33:32 +0200
committerGitHub <noreply@github.com>2020-10-01 23:33:32 +0200
commit8947147c25e2640519897bfdc8807e97ee291d70 (patch)
tree63eca1e5bd8ad29ac9beba5a780d466c9bb13849 /src/UI/EnchantingWindow.cpp
parentAdd SetBlockMeta warning in documentation (#4943) (diff)
downloadcuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar.gz
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar.bz2
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar.lz
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar.xz
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.tar.zst
cuberite-8947147c25e2640519897bfdc8807e97ee291d70.zip
Diffstat (limited to 'src/UI/EnchantingWindow.cpp')
-rw-r--r--src/UI/EnchantingWindow.cpp18
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;