From 16b650136a6ae8886f46801b0c1feb42938bf994 Mon Sep 17 00:00:00 2001 From: SoundSSGood <87084363+SoundSSGood@users.noreply.github.com> Date: Fri, 18 Nov 2022 00:24:06 +0200 Subject: [PATCH] backpack disassemble --- client/widgets/CArtifactHolder.cpp | 21 +++++++++++++++++++-- client/widgets/CArtifactHolder.h | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/widgets/CArtifactHolder.cpp b/client/widgets/CArtifactHolder.cpp index d5178fa71..1a62e495f 100644 --- a/client/widgets/CArtifactHolder.cpp +++ b/client/widgets/CArtifactHolder.cpp @@ -825,10 +825,17 @@ void CArtifactsOfHero::artifactAssembled(const ArtifactLocation &al) updateWornSlots(); } -void CArtifactsOfHero::artifactDisassembled(const ArtifactLocation &al) +void CArtifactsOfHero::artifactDisassembled(const ArtifactLocation & al) { if(al.isHolder(curHero)) - updateWornSlots(); + { + if(al.slot >= GameConstants::BACKPACK_START) + { + updateBackpackSlots(); + } + else + updateWornSlots(); + } } void CArtifactsOfHero::updateWornSlots(bool redrawParent) @@ -840,6 +847,16 @@ void CArtifactsOfHero::updateWornSlots(bool redrawParent) updateParentWindow(); } +void CArtifactsOfHero::updateBackpackSlots(bool redrawParent) +{ + for(auto & artPlace : backpack) + updateSlot(artPlace->slotID); + scrollBackpack(0); + + if(redrawParent) + updateParentWindow(); +} + const CGHeroInstance * CArtifactsOfHero::getHero() const { return curHero; diff --git a/client/widgets/CArtifactHolder.h b/client/widgets/CArtifactHolder.h index eff474737..272e99437 100644 --- a/client/widgets/CArtifactHolder.h +++ b/client/widgets/CArtifactHolder.h @@ -153,7 +153,8 @@ public: void markPossibleSlots(const CArtifactInstance* art); void unmarkSlots(bool withRedraw = true); //unmarks slots in all visible AOHs void unmarkLocalSlots(bool withRedraw = true); //unmarks slots in that particular AOH - void updateWornSlots (bool redrawParent = true); + void updateWornSlots(bool redrawParent = true); + void updateBackpackSlots(bool redrawParent = true); void updateSlot(ArtifactPosition i);