| 303 | } |
| 304 | |
| 305 | bool InventoryPane::giveContainerResult(ContainerResult result) { |
| 306 | if (!m_expectingSwap) |
| 307 | return false; |
| 308 | |
| 309 | for (auto& item : result) { |
| 310 | auto inv = m_player->inventory(); |
| 311 | m_player->triggerPickupEvents(item); |
| 312 | |
| 313 | auto remainder = inv->stackWith(m_containerSource, item); |
| 314 | if (remainder && !remainder->empty()) |
| 315 | m_player->giveItem(remainder); |
| 316 | } |
| 317 | |
| 318 | m_expectingSwap = false; |
| 319 | return true; |
| 320 | } |
| 321 | |
| 322 | void InventoryPane::updateItems() { |
| 323 | for (auto& p : m_itemGrids) |