1
0
This commit is contained in:
Tiger Wang 2015-05-18 15:43:24 +01:00
parent 0dbba305b6
commit 1632d5f8f1
2 changed files with 7 additions and 9 deletions

View File

@ -1394,7 +1394,7 @@ void cSlotAreaBeacon::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
// cSlotAreaEnchanting: // cSlotAreaEnchanting:
cSlotAreaEnchanting::cSlotAreaEnchanting(cWindow & a_ParentWindow, int a_BlockX, int a_BlockY, int a_BlockZ) : 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_BlockX(a_BlockX),
m_BlockY(a_BlockY), m_BlockY(a_BlockY),
m_BlockZ(a_BlockZ) m_BlockZ(a_BlockZ)

View File

@ -92,9 +92,9 @@ const AString cWindow::GetWindowTypeName(void) const
int cWindow::GetNumSlots(void) const int cWindow::GetNumSlots(void) const
{ {
int res = 0; 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[] } // for itr - m_SlotAreas[]
return res; return res;
} }
@ -261,16 +261,14 @@ void cWindow::Clicked(
} }
int LocalSlotNum = a_SlotNum; int LocalSlotNum = a_SlotNum;
int idx = 0; for (const auto & itr : m_SlotAreas)
for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
{ {
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; return;
} }
LocalSlotNum -= (*itr)->GetNumSlots(); LocalSlotNum -= itr->GetNumSlots();
idx++;
} }
LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.", LOGWARNING("Slot number higher than available window slots: %d, max %d received from \"%s\"; ignoring.",