mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
code review
This commit is contained in:
parent
cad0d5db16
commit
7cc004e139
@ -20,7 +20,7 @@
|
||||
"vcmi.adventureMap.playerAttacked" : "Player has been attacked: %s",
|
||||
"vcmi.adventureMap.moveCostDetails" : "Movement points - Cost: %TURNS turns + %POINTS points, Remaining points: %REMAINING",
|
||||
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Movement points - Cost: %POINTS points, Remaining points: %REMAINING",
|
||||
|
||||
|
||||
"vcmi.capitalColors.0" : "Red",
|
||||
"vcmi.capitalColors.1" : "Blue",
|
||||
"vcmi.capitalColors.2" : "Tan",
|
||||
@ -193,6 +193,7 @@
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.0" : "%d %s were killed by accurate shots!",
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.1" : "%d %s was killed with an accurate shot!",
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.2" : "%d %s were killed by accurate shots!",
|
||||
"vcmi.battleWindow.endWithAutocombat" : "Are you sure you wish to end the battle with auto combat?",
|
||||
|
||||
"vcmi.battleResultsWindow.applyResultsLabel" : "Apply battle result",
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
"vcmi.adventureMap.playerAttacked" : "Spieler wurde attackiert: %s",
|
||||
"vcmi.adventureMap.moveCostDetails" : "Bewegungspunkte - Kosten: %TURNS Runden + %POINTS Punkte, Verbleibende Punkte: %REMAINING",
|
||||
"vcmi.adventureMap.moveCostDetailsNoTurns" : "Bewegungspunkte - Kosten: %POINTS Punkte, Verbleibende Punkte: %REMAINING",
|
||||
|
||||
|
||||
"vcmi.capitalColors.0" : "Rot",
|
||||
"vcmi.capitalColors.1" : "Blau",
|
||||
"vcmi.capitalColors.2" : "Braun",
|
||||
@ -192,6 +192,7 @@
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.0" : "%d %s wurden durch gezielte Schüsse getötet!",
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.1" : "%d %s wurde mit einem gezielten Schuss getötet!",
|
||||
"vcmi.battleWindow.accurateShot.resultDescription.2" : "%d %s wurden durch gezielte Schüsse getötet!",
|
||||
"vcmi.battleWindow.endWithAutocombat" : "Seid Ihr sicher, dass Ihr den Kampf mit Auto-Kampf beenden wollt?",
|
||||
|
||||
"vcmi.battleResultsWindow.applyResultsLabel" : "Kampfergebnis übernehmen",
|
||||
|
||||
|
@ -56,8 +56,8 @@ BattleWindow::BattleWindow(BattleInterface & owner):
|
||||
|
||||
PlayerColor defenderColor = owner.getBattle()->getBattle()->getSidePlayer(BattleSide::DEFENDER);
|
||||
PlayerColor attackerColor = owner.getBattle()->getBattle()->getSidePlayer(BattleSide::ATTACKER);
|
||||
bool isDefenderHuman = defenderColor != PlayerColor::NEUTRAL && LOCPLINT->cb->getStartInfo()->playerInfos.at(defenderColor).isControlledByHuman();
|
||||
bool isAttackerHuman = attackerColor != PlayerColor::NEUTRAL && LOCPLINT->cb->getStartInfo()->playerInfos.at(attackerColor).isControlledByHuman();
|
||||
bool isDefenderHuman = defenderColor.isValidPlayer() && LOCPLINT->cb->getStartInfo()->playerInfos.at(defenderColor).isControlledByHuman();
|
||||
bool isAttackerHuman = attackerColor.isValidPlayer() && LOCPLINT->cb->getStartInfo()->playerInfos.at(attackerColor).isControlledByHuman();
|
||||
onlyOnePlayerHuman = isDefenderHuman != isAttackerHuman;
|
||||
|
||||
REGISTER_BUILDER("battleConsole", &BattleWindow::buildBattleConsole);
|
||||
@ -754,25 +754,32 @@ void BattleWindow::endWithAutocombat()
|
||||
if(!owner.makingTurn() || owner.tacticsMode)
|
||||
return;
|
||||
|
||||
owner.curInt->isAutoFightEndBattle = true;
|
||||
LOCPLINT->showYesNoDialog(
|
||||
VLC->generaltexth->translate("vcmi.battleWindow.endWithAutocombat"),
|
||||
[this]()
|
||||
{
|
||||
owner.curInt->isAutoFightEndBattle = true;
|
||||
|
||||
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
|
||||
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
|
||||
|
||||
AutocombatPreferences autocombatPreferences = AutocombatPreferences();
|
||||
autocombatPreferences.enableSpellsUsage = settings["battle"]["enableAutocombatSpells"].Bool();
|
||||
AutocombatPreferences autocombatPreferences = AutocombatPreferences();
|
||||
autocombatPreferences.enableSpellsUsage = settings["battle"]["enableAutocombatSpells"].Bool();
|
||||
|
||||
ai->initBattleInterface(owner.curInt->env, owner.curInt->cb, autocombatPreferences);
|
||||
ai->battleStart(owner.getBattleID(), owner.army1, owner.army2, int3(0,0,0), owner.attackingHeroInstance, owner.defendingHeroInstance, owner.getBattle()->battleGetMySide(), false);
|
||||
ai->initBattleInterface(owner.curInt->env, owner.curInt->cb, autocombatPreferences);
|
||||
ai->battleStart(owner.getBattleID(), owner.army1, owner.army2, int3(0,0,0), owner.attackingHeroInstance, owner.defendingHeroInstance, owner.getBattle()->battleGetMySide(), false);
|
||||
|
||||
owner.curInt->isAutoFightOn = true;
|
||||
owner.curInt->cb->registerBattleInterface(ai);
|
||||
owner.curInt->autofightingAI = ai;
|
||||
owner.curInt->isAutoFightOn = true;
|
||||
owner.curInt->cb->registerBattleInterface(ai);
|
||||
owner.curInt->autofightingAI = ai;
|
||||
|
||||
owner.requestAutofightingAIToTakeAction();
|
||||
owner.requestAutofightingAIToTakeAction();
|
||||
|
||||
close();
|
||||
close();
|
||||
|
||||
owner.curInt->battleInt.reset();
|
||||
owner.curInt->battleInt.reset();
|
||||
},
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
|
||||
void BattleWindow::showAll(Canvas & to)
|
||||
|
Loading…
Reference in New Issue
Block a user