1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #68 from ArseniyShestakov/smallFixesGUI

This looks innocent enought to be pulled. Thanks!
This commit is contained in:
DjWarmonger 2014-12-24 08:50:54 +01:00
commit 5995c975d3
4 changed files with 25 additions and 14 deletions

View File

@ -528,7 +528,7 @@ void CStackWindow::CWindowSection::createButtonPanel()
OBJ_CONSTRUCTION_CAPTURING_ALL;
createBackground("button-panel");
if (parent->info->dismissInfo)
if (parent->info->dismissInfo->callback)
{
auto onDismiss = [=]()
{
@ -597,7 +597,7 @@ void CStackWindow::CWindowSection::createButtonPanel()
parent->switchButtons[parent->activeTab]->disable();
}
auto exitBtn = new CButton(Point(382, 5), "hsbtns.def", CGI->generaltexth->zelp[445], [=]{ parent->close(); }, SDLK_RETURN);
auto exitBtn = new CButton(Point(382, 5), "hsbtns.def", CGI->generaltexth->zelp[447], [=]{ parent->close(); }, SDLK_RETURN);
exitBtn->assignedKeys.insert(SDLK_ESCAPE);
}

View File

@ -782,7 +782,7 @@ CTownItem::CTownItem(const CGTownInstance* Town):
background = new CAnimImage("OVSLOT", 6);
name = new CLabel(74, 8, FONT_SMALL, TOPLEFT, Colors::WHITE, town->name);
income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()));
income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]));
hall = new CTownInfo( 69, 31, town, true);
fort = new CTownInfo(111, 31, town, false);
@ -813,7 +813,7 @@ void CTownItem::updateGarrisons()
void CTownItem::update()
{
std::string incomeVal = boost::lexical_cast<std::string>(town->dailyIncome());
std::string incomeVal = boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]);
if (incomeVal != income->text)
income->setText(incomeVal);

View File

@ -734,8 +734,8 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
break;
case EMarketMode::ARTIFACT_RESOURCE:
//%s's Artifacts
new CLabel(152, 102, FONT_SMALL, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name));
new CLabel(152, 56, FONT_SMALL, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->name));
break;
}
@ -1011,8 +1011,8 @@ void CMarketplaceWindow::getBaseForPositions(EType type, int &dx, int &dy, int &
dy = 79;
x = 39;
y = 180;
h = 66;
w = 74;
h = 68;
w = 70;
break;
case PLAYER:
dx = 83;

View File

@ -400,14 +400,25 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i
void CSplitWindow::setAmountText(std::string text, bool left)
{
try
{
setAmount(boost::lexical_cast<int>(text), left);
slider->moveTo(rightAmount - rightMin);
}
catch(boost::bad_lexical_cast &)
int amount = 0;
if (text.length())
{
try
{
amount = boost::lexical_cast<int>(text);
}
catch(boost::bad_lexical_cast &)
{
amount = left ? leftAmount : rightAmount;
}
int total = leftAmount + rightAmount;
if (amount > total)
amount = total;
}
setAmount(amount, left);
slider->moveTo(rightAmount - rightMin);
}
void CSplitWindow::setAmount(int value, bool left)