From 8d40a4aa956a98b4a622acce796007da1d94c586 Mon Sep 17 00:00:00 2001 From: Vadim Markovtsev Date: Sun, 30 Oct 2016 22:21:26 +0100 Subject: [PATCH] Fix GUI disposal in creature info window --- client/windows/CCreatureWindow.cpp | 22 ++++++++++++---------- client/windows/CCreatureWindow.h | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/client/windows/CCreatureWindow.cpp b/client/windows/CCreatureWindow.cpp index bc7e156de..65795ec6e 100644 --- a/client/windows/CCreatureWindow.cpp +++ b/client/windows/CCreatureWindow.cpp @@ -262,13 +262,12 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt) if (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]; - reinterpret_cast(parent->expArea.get())->bonusValue = + reinterpret_cast(parent->expArea)->bonusValue = commander->getExpRank(); boost::replace_first(parent->expArea->text, "%d", boost::lexical_cast(commander->getExpRank())); @@ -279,14 +278,14 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt) } 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->expLabel.reset(new CLabel( + parent->expLabel = new CLabel( pos.x + 21, pos.y + 52, FONT_SMALL, CENTER, Colors::WHITE, - makeNumberShort(stack->experience, 6))); + makeNumberShort(stack->experience, 6)); } if (showArt) @@ -300,8 +299,10 @@ void CStackWindow::CWindowSection::createStackInfo(bool showExp, bool showArt) { parent->stackArtifactIcon.reset(new CAnimImage( "ARTIFACT", art->artType->iconIndex, 0, pos.x, pos.y)); + parent->stackArtifactIcon->recActions &= ~DISPOSE; parent->stackArtifactHelp.reset(new LRClickableAreaWTextComp(Rect( pos, Point(44, 44)), CComponent::artifact)); + parent->stackArtifactHelp->recActions &= ~DISPOSE; parent->stackArtifactHelp->type = art->artType->id; const JsonNode & text = 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", CButton::tooltip(text), [=]{ parent->removeStackArtifact(ArtifactPosition::CREATURE_SLOT); })); + parent->stackArtifactButton->recActions &= ~DISPOSE; } } } diff --git a/client/windows/CCreatureWindow.h b/client/windows/CCreatureWindow.h index 83d329329..e89e65f7c 100644 --- a/client/windows/CCreatureWindow.h +++ b/client/windows/CCreatureWindow.h @@ -74,9 +74,9 @@ class CStackWindow : public CWindowObject std::unique_ptr stackArtifactIcon; std::unique_ptr stackArtifactHelp; std::unique_ptr stackArtifactButton; - std::unique_ptr expRankIcon; - std::unique_ptr expArea; - std::unique_ptr expLabel; + CAnimImage *expRankIcon; + LRClickableAreaWText *expArea; + CLabel *expLabel; std::unique_ptr info; std::vector activeBonuses;