1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Complete quick combat feature

This commit is contained in:
nordsoft 2023-04-06 22:49:38 +04:00
parent e85593dbb3
commit b1d06b6141
4 changed files with 14 additions and 10 deletions

View File

@ -94,6 +94,8 @@
"vcmi.battleWindow.damageEstimation.kills" : "%d will perish",
"vcmi.battleWindow.damageEstimation.kills.1" : "%d will perish",
"vcmi.battleResultsWindow.applyResultsLabel" : "Apply battle result",
"vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover" : "Show Available Creatures",
"vcmi.otherOptions.availableCreaturesAsDwellingLabel.help" : "{Show Available Creatures}\n\nShow the number of creatures available to purchase instead of their growth in town summary (bottom-left corner of town screen).",
"vcmi.otherOptions.creatureGrowthAsDwellingLabel.hover" : "Show Weekly Growth of Creatures",

View File

@ -413,6 +413,7 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
{
repeat = std::make_shared<CButton>(Point(24, 505), "icn6432.def", std::make_pair("", ""), [&](){ bRepeatf();}, SDLK_ESCAPE);
repeat->setBorderColor(Colors::METALLIC_GOLD);
labels.push_back(std::make_shared<CLabel>(232, 520, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->translate("vcmi.battleResultsWindow.applyResultsLabel")));
}
if(br.winner == 0) //attacker won

View File

@ -357,14 +357,14 @@ void CGStatusBar::setEnteringMode(bool on)
if (on)
{
assert(enteringText == false);
//assert(enteringText == false);
alignment = ETextAlignment::TOPLEFT;
GH.startTextInput(pos);
setText(consoleText);
}
else
{
assert(enteringText == true);
//assert(enteringText == true);
alignment = ETextAlignment::CENTER;
GH.stopTextInput();
setText(hoverText);

View File

@ -623,14 +623,6 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
}
battleQuery->result = boost::make_optional(*battleResult.data);
//set same battle result for all queries
for(auto q : queries.allQueries())
{
auto otherBattleQuery = std::dynamic_pointer_cast<CBattleQuery>(q);
if(otherBattleQuery && otherBattleQuery->bi == battleQuery->bi)
otherBattleQuery->result = battleQuery->result;
}
//Check how many battle queries were created (number of players blocked by battle)
const int queriedPlayers = battleQuery ? (int)boost::count(queries.allQueries(), battleQuery) : 0;
@ -639,6 +631,15 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
auto battleDialogQuery = std::make_shared<CBattleDialogQuery>(this, gs->curB);
battleResult.data->queryID = battleDialogQuery->queryID;
queries.addQuery(battleDialogQuery);
//set same battle result for all queries
for(auto q : queries.allQueries())
{
auto otherBattleQuery = std::dynamic_pointer_cast<CBattleQuery>(q);
if(otherBattleQuery)
otherBattleQuery->result = battleQuery->result;
}
sendAndApply(battleResult.data); //after this point casualties objects are destroyed
}