summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-18 16:43:24 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-18 16:43:24 +0200
commit1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca (patch)
treef3941cbeb774d6149b5348d6be42ec2affff7f09
parentFixes #2052 (diff)
downloadcuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar.gz
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar.bz2
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar.lz
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar.xz
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.tar.zst
cuberite-1632d5f8f1f3f1edb7ac2d0f4c79be9fbdae91ca.zip
Diffstat (limited to '')
-rw-r--r--src/UI/SlotArea.cpp2
-rw-r--r--src/UI/Window.cpp14
2 files changed, 7 insertions, 9 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 37683a8e5..accd44b06 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1394,7 +1394,7 @@ void cSlotAreaBeacon::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
// cSlotAreaEnchanting:
cSlotAreaEnchanting::cSlotAreaEnchanting(cWindow & a_ParentWindow, int a_BlockX, int a_BlockY, int a_BlockZ) :
- cSlotAreaTemporary(1, a_ParentWindow),
+ cSlotAreaTemporary(2, a_ParentWindow),
m_BlockX(a_BlockX),
m_BlockY(a_BlockY),
m_BlockZ(a_BlockZ)
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index d1c08acec..61e25651b 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -92,9 +92,9 @@ const AString cWindow::GetWindowTypeName(void) const
int cWindow::GetNumSlots(void) const
{
int res = 0;
- for (cSlotAreas::const_iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ for (const auto & itr : m_SlotAreas)
{
- res += (*itr)->GetNumSlots();
+ res += itr->GetNumSlots();
} // for itr - m_SlotAreas[]
return res;
}
@@ -261,16 +261,14 @@ void cWindow::Clicked(
}
int LocalSlotNum = a_SlotNum;
- int idx = 0;
- for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
+ for (const auto & itr : m_SlotAreas)
{
- if (LocalSlotNum < (*itr)->GetNumSlots())
+ if (LocalSlotNum < itr->GetNumSlots())
{
- (*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
+ itr->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
return;
}
- LocalSlotNum -= (*itr)->GetNumSlots();
- idx++;
+ LocalSlotNum -= itr->GetNumSlots();
}
LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.",