Browse Source

Fix GUI disposal in creature info window

Vadim Markovtsev 9 years ago
parent
commit
8d40a4aa95
2 changed files with 15 additions and 13 deletions
  1. 12 10
      client/windows/CCreatureWindow.cpp
  2. 3 3
      client/windows/CCreatureWindow.h

+ 12 - 10
client/windows/CCreatureWindow.cpp

@@ -262,13 +262,12 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
 		if (parent->info->commander)
 		if (parent->info->commander)
 		{
 		{
 			const CCommanderInstance * commander = parent->info->commander;
 			const CCommanderInstance * commander = parent->info->commander;
-			parent->expRankIcon.reset(new CAnimImage(
-					"PSKIL42", 4, 0, pos.x, pos.y)); // experience icon
+			parent->expRankIcon = new CAnimImage("PSKIL42", 4, 0, pos.x, pos.y); // experience icon
 
 
-			parent->expArea.reset(new LRClickableAreaWTextComp(Rect(
-					pos.x, pos.y, 44, 44), CComponent::experience));
+			parent->expArea = new LRClickableAreaWTextComp(Rect(
+					pos.x, pos.y, 44, 44), CComponent::experience);
 			parent->expArea->text = CGI->generaltexth->allTexts[2];
 			parent->expArea->text = CGI->generaltexth->allTexts[2];
-			reinterpret_cast<LRClickableAreaWTextComp*>(parent->expArea.get())->bonusValue =
+			reinterpret_cast<LRClickableAreaWTextComp*>(parent->expArea)->bonusValue =
 					commander->getExpRank();
 					commander->getExpRank();
 			boost::replace_first(parent->expArea->text, "%d",
 			boost::replace_first(parent->expArea->text, "%d",
 								 boost::lexical_cast<std::string>(commander->getExpRank()));
 								 boost::lexical_cast<std::string>(commander->getExpRank()));
@@ -279,14 +278,14 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
 		}
 		}
 		else
 		else
 		{
 		{
-			parent->expRankIcon.reset(new CAnimImage(
-					"stackWindow/levels", stack->getExpRank(), 0, pos.x, pos.y));
-			parent->expArea.reset(new LRClickableAreaWText(Rect(pos.x, pos.y, 44, 44)));
+			parent->expRankIcon = new CAnimImage(
+					"stackWindow/levels", stack->getExpRank(), 0, pos.x, pos.y);
+			parent->expArea = new LRClickableAreaWText(Rect(pos.x, pos.y, 44, 44));
 			parent->expArea->text = parent->generateStackExpDescription();
 			parent->expArea->text = parent->generateStackExpDescription();
 		}
 		}
-		parent->expLabel.reset(new CLabel(
+		parent->expLabel = new CLabel(
 				pos.x + 21, pos.y + 52, FONT_SMALL, CENTER, Colors::WHITE,
 				pos.x + 21, pos.y + 52, FONT_SMALL, CENTER, Colors::WHITE,
-				makeNumberShort<TExpType>(stack->experience, 6)));
+				makeNumberShort<TExpType>(stack->experience, 6));
 	}
 	}
 
 
 	if (showArt)
 	if (showArt)
@@ -300,8 +299,10 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
 		{
 		{
 			parent->stackArtifactIcon.reset(new CAnimImage(
 			parent->stackArtifactIcon.reset(new CAnimImage(
 					"ARTIFACT", art->artType->iconIndex, 0, pos.x, pos.y));
 					"ARTIFACT", art->artType->iconIndex, 0, pos.x, pos.y));
+			parent->stackArtifactIcon->recActions &= ~DISPOSE;
 			parent->stackArtifactHelp.reset(new LRClickableAreaWTextComp(Rect(
 			parent->stackArtifactHelp.reset(new LRClickableAreaWTextComp(Rect(
 					pos, Point(44, 44)), CComponent::artifact));
 					pos, Point(44, 44)), CComponent::artifact));
+			parent->stackArtifactHelp->recActions &= ~DISPOSE;
 			parent->stackArtifactHelp->type = art->artType->id;
 			parent->stackArtifactHelp->type = art->artType->id;
 			const JsonNode & text =
 			const JsonNode & text =
 					VLC->generaltexth->localizedTexts["creatureWindow"]["returnArtifact"];
 					VLC->generaltexth->localizedTexts["creatureWindow"]["returnArtifact"];
@@ -312,6 +313,7 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt)
 						Point(pos.x - 2 , pos.y + 46), "stackWindow/cancelButton",
 						Point(pos.x - 2 , pos.y + 46), "stackWindow/cancelButton",
 						CButton::tooltip(text),
 						CButton::tooltip(text),
 						[=]{ parent->removeStackArtifact(ArtifactPosition::CREATURE_SLOT); }));
 						[=]{ parent->removeStackArtifact(ArtifactPosition::CREATURE_SLOT); }));
+				parent->stackArtifactButton->recActions &= ~DISPOSE;
 			}
 			}
 		}
 		}
 	}
 	}

+ 3 - 3
client/windows/CCreatureWindow.h

@@ -74,9 +74,9 @@ class CStackWindow : public CWindowObject
 	std::unique_ptr<CAnimImage> stackArtifactIcon;
 	std::unique_ptr<CAnimImage> stackArtifactIcon;
 	std::unique_ptr<LRClickableAreaWTextComp> stackArtifactHelp;
 	std::unique_ptr<LRClickableAreaWTextComp> stackArtifactHelp;
 	std::unique_ptr<CButton> stackArtifactButton;
 	std::unique_ptr<CButton> stackArtifactButton;
-	std::unique_ptr<CAnimImage> expRankIcon;
-	std::unique_ptr<LRClickableAreaWText> expArea;
-	std::unique_ptr<CLabel> expLabel;
+	CAnimImage *expRankIcon;
+	LRClickableAreaWText *expArea;
+	CLabel *expLabel;
 
 
 	std::unique_ptr<StackWindowInfo> info;
 	std::unique_ptr<StackWindowInfo> info;
 	std::vector<BonusInfo> activeBonuses;
 	std::vector<BonusInfo> activeBonuses;