mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
When the battle is won with only summoned creatures - defeat
This commit is contained in:
parent
05b5ab62aa
commit
e0e3787748
@ -406,16 +406,23 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult & br, CPlayerInterfa
|
|||||||
exit = std::make_shared<CButton>(Point(384, 505), "iok6432.def", std::make_pair("", ""), [&](){ bExitf();}, SDLK_RETURN);
|
exit = std::make_shared<CButton>(Point(384, 505), "iok6432.def", std::make_pair("", ""), [&](){ bExitf();}, SDLK_RETURN);
|
||||||
exit->setBorderColor(Colors::METALLIC_GOLD);
|
exit->setBorderColor(Colors::METALLIC_GOLD);
|
||||||
|
|
||||||
if(br.winner==0) //attacker won
|
if(br.winner == 0) //attacker won
|
||||||
{
|
{
|
||||||
labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]));
|
labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]));
|
||||||
labels.push_back(std::make_shared<CLabel>(408, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]));
|
|
||||||
}
|
}
|
||||||
else //if(br.winner==1)
|
else
|
||||||
{
|
{
|
||||||
labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]));
|
labels.push_back(std::make_shared<CLabel>(59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(br.winner == 1)
|
||||||
|
{
|
||||||
labels.push_back(std::make_shared<CLabel>(412, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]));
|
labels.push_back(std::make_shared<CLabel>(412, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
labels.push_back(std::make_shared<CLabel>(408, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]));
|
||||||
|
}
|
||||||
|
|
||||||
labels.push_back(std::make_shared<CLabel>(232, 302, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[407]));
|
labels.push_back(std::make_shared<CLabel>(232, 302, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[407]));
|
||||||
labels.push_back(std::make_shared<CLabel>(232, 332, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[408]));
|
labels.push_back(std::make_shared<CLabel>(232, 332, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[408]));
|
||||||
|
@ -1968,7 +1968,7 @@ boost::optional<int> CBattleInfoCallback::battleIsFinished() const
|
|||||||
{
|
{
|
||||||
auto units = battleGetUnitsIf([=](const battle::Unit * unit)
|
auto units = battleGetUnitsIf([=](const battle::Unit * unit)
|
||||||
{
|
{
|
||||||
return unit->alive() && !unit->isTurret() && unit->alive();
|
return unit->alive() && !unit->isTurret() && !unit->hasBonusOfType(Bonus::SIEGE_WEAPON);
|
||||||
});
|
});
|
||||||
|
|
||||||
std::array<bool, 2> hasUnit = {false, false}; //index is BattleSide
|
std::array<bool, 2> hasUnit = {false, false}; //index is BattleSide
|
||||||
@ -1976,20 +1976,26 @@ boost::optional<int> CBattleInfoCallback::battleIsFinished() const
|
|||||||
for(auto & unit : units)
|
for(auto & unit : units)
|
||||||
{
|
{
|
||||||
//todo: move SIEGE_WEAPON check to Unit state
|
//todo: move SIEGE_WEAPON check to Unit state
|
||||||
if(!unit->hasBonusOfType(Bonus::SIEGE_WEAPON))
|
hasUnit.at(unit->unitSide()) = true;
|
||||||
|
|
||||||
|
if(hasUnit[0] && hasUnit[1])
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasUnit = {false, false};
|
||||||
|
|
||||||
|
for(auto & unit : units)
|
||||||
|
{
|
||||||
|
if(!unit->isClone() && !unit->acquireState()->summoned && !dynamic_cast <const CCommanderInstance *>(unit))
|
||||||
{
|
{
|
||||||
hasUnit.at(unit->unitSide()) = true;
|
hasUnit.at(unit->unitSide()) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasUnit[0] && hasUnit[1])
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasUnit[0] && !hasUnit[1])
|
if(!hasUnit[0] && !hasUnit[1])
|
||||||
return 2;
|
return 2;
|
||||||
if(!hasUnit[1])
|
if(!hasUnit[1])
|
||||||
return 0;
|
return 0;
|
||||||
if(!hasUnit[0])
|
else
|
||||||
return 1;
|
return 1;
|
||||||
return boost::none;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user