summaryrefslogtreecommitdiffstats
path: root/src/UI/Window.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2015-05-27 13:21:17 +0200
committerAlexander Harkness <me@bearbin.net>2015-05-27 13:21:17 +0200
commitda4a76bb5043d072513b74823dc79279c75dd70c (patch)
tree5c46cca70beb5e0b0d0161b5ccb306425e6426dd /src/UI/Window.cpp
parentMerge pull request #2143 from jammet/patch-6 (diff)
parentFixes #2041 (diff)
downloadcuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar.gz
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar.bz2
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar.lz
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar.xz
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.tar.zst
cuberite-da4a76bb5043d072513b74823dc79279c75dd70c.zip
Diffstat (limited to 'src/UI/Window.cpp')
-rw-r--r--src/UI/Window.cpp14
1 files changed, 6 insertions, 8 deletions
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.",