mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fix GUI disposal in creature info window
This commit is contained in:
parent
34005228e0
commit
8d40a4aa95
@ -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(
|
parent->expRankIcon = new CAnimImage("PSKIL42", 4, 0, pos.x, pos.y); // experience icon
|
||||||
"PSKIL42", 4, 0, pos.x, pos.y)); // experience icon
|
|
||||||
|
|
||||||
parent->expArea.reset(new LRClickableAreaWTextComp(Rect(
|
parent->expArea = new LRClickableAreaWTextComp(Rect(
|
||||||
pos.x, pos.y, 44, 44), CComponent::experience));
|
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(
|
parent->expRankIcon = new CAnimImage(
|
||||||
"stackWindow/levels", stack->getExpRank(), 0, pos.x, pos.y));
|
"stackWindow/levels", stack->getExpRank(), 0, pos.x, pos.y);
|
||||||
parent->expArea.reset(new LRClickableAreaWText(Rect(pos.x, pos.y, 44, 44)));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
CAnimImage *expRankIcon;
|
||||||
std::unique_ptr<LRClickableAreaWText> expArea;
|
LRClickableAreaWText *expArea;
|
||||||
std::unique_ptr<CLabel> expLabel;
|
CLabel *expLabel;
|
||||||
|
|
||||||
std::unique_ptr<StackWindowInfo> info;
|
std::unique_ptr<StackWindowInfo> info;
|
||||||
std::vector<BonusInfo> activeBonuses;
|
std::vector<BonusInfo> activeBonuses;
|
||||||
|
Loading…
Reference in New Issue
Block a user