MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / giveContainerResult

Method giveContainerResult

source/frontend/StarContainerInterface.cpp:183–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183bool ContainerPane::giveContainerResult(ContainerResult result) {
184 if (m_expectingSwap == ExpectingSwap::None)
185 return false;
186
187 for (auto item : result) {
188 auto inv = m_player->inventory();
189 m_player->triggerPickupEvents(item);
190
191 if (m_expectingSwap == ExpectingSwap::SwapSlot) {
192 m_player->clearSwap();
193 inv->setSwapSlotItem(item);
194 } else if (m_expectingSwap == ExpectingSwap::SwapSlotStack) {
195 auto swapItem = inv->swapSlotItem();
196 if (swapItem && swapItem->stackWith(item)) {
197 continue;
198 } else {
199 inv->clearSwap();
200 inv->setSwapSlotItem(item);
201 }
202 } else {
203 m_containerInteractor->addToContainer(inv->addItems(item));
204 }
205 }
206
207 m_expectingSwap = ExpectingSwap::None;
208 return true;
209}
210
211PanePtr ContainerPane::createTooltip(Vec2I const& screenPosition) {
212 ItemPtr item;

Callers

nothing calls this directly

Calls 8

inventoryMethod · 0.80
triggerPickupEventsMethod · 0.80
setSwapSlotItemMethod · 0.80
swapSlotItemMethod · 0.80
addToContainerMethod · 0.80
clearSwapMethod · 0.45
stackWithMethod · 0.45
addItemsMethod · 0.45

Tested by

no test coverage detected