Browse Source

backpack disassemble

SoundSSGood 2 years ago
parent
commit
16b650136a
2 changed files with 21 additions and 3 deletions
  1. 19 2
      client/widgets/CArtifactHolder.cpp
  2. 2 1
      client/widgets/CArtifactHolder.h

+ 19 - 2
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;

+ 2 - 1
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);