diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-22 22:31:04 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-22 22:31:04 +1000 |
commit | cb19eef701b5c9e27d0464795fffcf8a4d795a21 (patch) | |
tree | 5cfbdf49ebd7ac9539891eea850e244887d4c355 /source/frontend/StarInventory.cpp | |
parent | 4fbd67daccfa69df6988bdf17c67ee3d5f3049c5 (diff) |
Add character swapping (no GUI yet)
Diffstat (limited to 'source/frontend/StarInventory.cpp')
-rw-r--r-- | source/frontend/StarInventory.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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(); |