MCPcopy Create free account
hub / github.com/cuberite/cuberite / GetSlots

Method GetSlots

src/UI/Window.cpp:140–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138
139
140void cWindow::GetSlots(cPlayer & a_Player, cItems & a_Slots) const
141{
142 a_Slots.clear();
143 a_Slots.reserve(GetNumSlots());
144 for (cSlotAreas::const_iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr)
145 {
146 int NumSlots = (*itr)->GetNumSlots();
147 for (int i = 0; i < NumSlots; i++)
148 {
149
150 const cItem * Item = (*itr)->GetSlot(i, a_Player);
151 if (Item == NULL)
152 {
153 a_Slots.push_back(cItem());
154 }
155 else
156 {
157 a_Slots.push_back(*Item);
158 }
159 }
160 } // for itr - m_SlotAreas[]
161}
162
163
164

Callers 2

SendWholeInventoryMethod · 0.80
SendWholeInventoryMethod · 0.80

Calls 6

clearMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
cItemClass · 0.50
GetNumSlotsMethod · 0.45
GetSlotMethod · 0.45

Tested by

no test coverage detected