1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Fixed CID 1243197

This commit is contained in:
AlexVinS 2016-11-28 02:47:40 +03:00
parent 2a62ca9522
commit 7d29365e4a

View File

@ -548,17 +548,23 @@ CGarrisonWindow::CGarrisonWindow( const CArmedInstance *up, const CGHeroInstance
quit = new CButton(Point(399, 314), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->tcommands[8], ""), [&]{ close(); }, SDLK_RETURN); quit = new CButton(Point(399, 314), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->tcommands[8], ""), [&]{ close(); }, SDLK_RETURN);
std::string titleText; std::string titleText;
if (garr->armedObjs[1]->tempOwner == garr->armedObjs[0]->tempOwner) if (down->tempOwner == up->tempOwner)
titleText = CGI->generaltexth->allTexts[709]; titleText = CGI->generaltexth->allTexts[709];
else else
{ {
titleText = CGI->generaltexth->allTexts[35]; //assume that this is joining monsters dialog
boost::algorithm::replace_first(titleText, "%s", garr->armedObjs[0]->Slots().begin()->second->type->namePl); if(up->Slots().size() > 0)
{
titleText = CGI->generaltexth->allTexts[35];
boost::algorithm::replace_first(titleText, "%s", up->Slots().begin()->second->type->namePl);
}
else
logGlobal->error("Invalid armed instance for garrison window.");
} }
new CLabel(275, 30, FONT_BIG, CENTER, Colors::YELLOW, titleText); new CLabel(275, 30, FONT_BIG, CENTER, Colors::YELLOW, titleText);
new CAnimImage("CREST58", garr->armedObjs[0]->getOwner().getNum(), 0, 28, 124); new CAnimImage("CREST58", up->getOwner().getNum(), 0, 28, 124);
new CAnimImage("PortraitsLarge", dynamic_cast<const CGHeroInstance*>(garr->armedObjs[1])->portrait, 0, 29, 222); new CAnimImage("PortraitsLarge", down->portrait, 0, 29, 222);
} }
CGarrisonHolder::CGarrisonHolder() CGarrisonHolder::CGarrisonHolder()