Fix broken coin placement in levelup dialog + possible memleak

deque
MiroslavR 10 years ago
parent 4894699eba
commit 5977860e09

@ -83,14 +83,20 @@ namespace MWGui
{
const int coinSpacing = 10;
int curX = mCoinBox->getWidth()/2 - (coinSpacing*(mCoinCount - 1) + 16*mCoinCount)/2;
for (unsigned int i=0; i<mCoinCount; ++i)
for (unsigned int i=0; i<sMaxCoins; ++i)
{
MyGUI::ImageBox* image = mCoins[i];
image->detachFromWidget();
image->attachToWidget(mCoinBox);
if (i < mCoinCount)
{
mCoins[i]->setVisible(true);
image->setCoord(MyGUI::IntCoord(curX,0,16,16));
curX += 16+coinSpacing;
}
else
mCoins[i]->setVisible(false);
}
}
void LevelupDialog::assignCoins()
@ -178,14 +184,6 @@ namespace MWGui
mCoinCount = std::min(sMaxCoins, availableAttributes);
for (unsigned int i = 0; i < sMaxCoins; i++)
{
if (i < mCoinCount)
mCoins[i]->attachToWidget(mCoinBox);
else
mCoins[i]->detachFromWidget();
}
mSpentAttributes.clear();
resetCoins();

@ -559,6 +559,8 @@ namespace MWGui
Box * b = dynamic_cast<Box*>(parent);
if (b)
b->notifyChildrenSizeChanged();
else
break;
parent = parent->getParent();
}
}

@ -92,7 +92,6 @@
<UserString key="HStretch" value="true"/>
</Widget>
</Widget>
<Widget type="Widget"/>
</Widget>
<!-- Available effects -->

Loading…
Cancel
Save