From cb19eef701b5c9e27d0464795fffcf8a4d795a21 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 22 Jul 2023 22:31:04 +1000 Subject: Add character swapping (no GUI yet) --- source/frontend/StarInventory.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/frontend/StarInventory.cpp') diff --git a/source/frontend/StarInventory.cpp b/source/frontend/StarInventory.cpp index a7626a7..a983f3e 100644 --- a/source/frontend/StarInventory.cpp +++ b/source/frontend/StarInventory.cpp @@ -210,7 +210,7 @@ bool InventoryPane::giveContainerResult(ContainerResult result) { if (!m_expectingSwap) return false; - for (auto item : result) { + for (auto& item : result) { auto inv = m_player->inventory(); m_player->triggerPickupEvents(item); @@ -224,18 +224,25 @@ bool InventoryPane::giveContainerResult(ContainerResult result) { } void InventoryPane::updateItems() { - for (auto p : m_itemGrids) + for (auto& p : m_itemGrids) p.second->updateItemState(); } bool InventoryPane::containsNewItems() const { - for (auto p : m_itemGrids) { + for (auto& p : m_itemGrids) { if (p.second->slotsChanged()) return true; } return false; } +void InventoryPane::clearChangedSlots() { + for (auto& p : m_itemGrids) { + p.second->updateItemState(); + p.second->clearChangedSlots(); + } +} + void InventoryPane::update(float dt) { auto inventory = m_player->inventory(); auto context = Widget::context(); -- cgit v1.2.3