From 33ea28c5dd929465abaecc033669479d94d21d95 Mon Sep 17 00:00:00 2001 From: dydzio Date: Fri, 30 Sep 2016 20:45:23 +0200 Subject: [PATCH] Improve creature upgrade handling. Fix issue #2172 --- client/windows/CCreatureWindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/windows/CCreatureWindow.cpp b/client/windows/CCreatureWindow.cpp index 5dd928993..18274ee50 100644 --- a/client/windows/CCreatureWindow.cpp +++ b/client/windows/CCreatureWindow.cpp @@ -580,14 +580,17 @@ void CStackWindow::CWindowSection::createButtonPanel() { 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); upgradeBtn->addOverlay(new CAnimImage("CPRSMALL", VLC->creh->creatures[upgradeInfo.info.newID[i]]->iconIndex)); - - if (!LOCPLINT->cb->getResourceAmount().canAfford(totalCost)) - upgradeBtn->block(true); } }