1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-02 22:05:43 +02:00

Merge pull request #225 from dydzio0614/CreatureUpgradeWindow

Improve creature upgrade handling. Fix issue #2172
This commit is contained in:
ArseniyShestakov 2016-09-30 22:31:07 +03:00 committed by GitHub
commit 95ee76977f

View File

@ -580,14 +580,17 @@ void CStackWindow::CWindowSection::createButtonPanel()
{ {
resComps.push_back(new CComponent(CComponent::resource, i->resType, i->resVal)); resComps.push_back(new CComponent(CComponent::resource, i->resType, i->resVal));
} }
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[207], onUpgrade, nullptr, true, resComps);
if(LOCPLINT->cb->getResourceAmount().canAfford(totalCost))
{
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[207], onUpgrade, nullptr, true, resComps);
}
else
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[314], resComps);
}; };
auto upgradeBtn = new CButton(Point(221 + i * 40, 5), "stackWindow/upgradeButton", CGI->generaltexth->zelp[446], onClick, SDLK_1); auto upgradeBtn = new CButton(Point(221 + i * 40, 5), "stackWindow/upgradeButton", CGI->generaltexth->zelp[446], onClick, SDLK_1);
upgradeBtn->addOverlay(new CAnimImage("CPRSMALL", VLC->creh->creatures[upgradeInfo.info.newID[i]]->iconIndex)); upgradeBtn->addOverlay(new CAnimImage("CPRSMALL", VLC->creh->creatures[upgradeInfo.info.newID[i]]->iconIndex));
if (!LOCPLINT->cb->getResourceAmount().canAfford(totalCost))
upgradeBtn->block(true);
} }
} }