mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-07 00:58:39 +02:00
Complete quick combat feature
This commit is contained in:
@ -94,6 +94,8 @@
|
|||||||
"vcmi.battleWindow.damageEstimation.kills" : "%d will perish",
|
"vcmi.battleWindow.damageEstimation.kills" : "%d will perish",
|
||||||
"vcmi.battleWindow.damageEstimation.kills.1" : "%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.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.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",
|
"vcmi.otherOptions.creatureGrowthAsDwellingLabel.hover" : "Show Weekly Growth of Creatures",
|
||||||
|
@ -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 = std::make_shared<CButton>(Point(24, 505), "icn6432.def", std::make_pair("", ""), [&](){ bRepeatf();}, SDLK_ESCAPE);
|
||||||
repeat->setBorderColor(Colors::METALLIC_GOLD);
|
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
|
if(br.winner == 0) //attacker won
|
||||||
|
@ -357,14 +357,14 @@ void CGStatusBar::setEnteringMode(bool on)
|
|||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
assert(enteringText == false);
|
//assert(enteringText == false);
|
||||||
alignment = ETextAlignment::TOPLEFT;
|
alignment = ETextAlignment::TOPLEFT;
|
||||||
GH.startTextInput(pos);
|
GH.startTextInput(pos);
|
||||||
setText(consoleText);
|
setText(consoleText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(enteringText == true);
|
//assert(enteringText == true);
|
||||||
alignment = ETextAlignment::CENTER;
|
alignment = ETextAlignment::CENTER;
|
||||||
GH.stopTextInput();
|
GH.stopTextInput();
|
||||||
setText(hoverText);
|
setText(hoverText);
|
||||||
|
@ -624,14 +624,6 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
|
|||||||
|
|
||||||
battleQuery->result = boost::make_optional(*battleResult.data);
|
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)
|
//Check how many battle queries were created (number of players blocked by battle)
|
||||||
const int queriedPlayers = battleQuery ? (int)boost::count(queries.allQueries(), battleQuery) : 0;
|
const int queriedPlayers = battleQuery ? (int)boost::count(queries.allQueries(), battleQuery) : 0;
|
||||||
finishingBattle = std::make_unique<FinishingBattleHelper>(battleQuery, queriedPlayers);
|
finishingBattle = std::make_unique<FinishingBattleHelper>(battleQuery, queriedPlayers);
|
||||||
@ -639,6 +631,15 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
|
|||||||
auto battleDialogQuery = std::make_shared<CBattleDialogQuery>(this, gs->curB);
|
auto battleDialogQuery = std::make_shared<CBattleDialogQuery>(this, gs->curB);
|
||||||
battleResult.data->queryID = battleDialogQuery->queryID;
|
battleResult.data->queryID = battleDialogQuery->queryID;
|
||||||
queries.addQuery(battleDialogQuery);
|
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
|
sendAndApply(battleResult.data); //after this point casualties objects are destroyed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user