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

consider unlimited replay (or not)

This commit is contained in:
Laserlicht 2024-01-27 15:02:03 +01:00 committed by GitHub
parent 3e71cbcc39
commit cad0d5db16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -145,6 +145,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
firstCall = 1; //if loading will be overwritten in serialize
autosaveCount = 0;
isAutoFightOn = false;
isAutoFightEndBattle = false;
ignoreEvents = false;
numOfMovedArts = 0;
}
@ -782,17 +783,20 @@ void CPlayerInterface::battleEnd(const BattleID & battleID, const BattleResult *
if(!battleInt)
{
bool allowManualReplay = queryID != QueryID::NONE;
bool allowManualReplay = queryID != QueryID::NONE && !isAutoFightEndBattle;
auto wnd = std::make_shared<BattleResultWindow>(*br, *this, allowManualReplay);
if (allowManualReplay)
if (allowManualReplay || isAutoFightEndBattle)
{
wnd->resultCallback = [=](ui32 selection)
{
cb->selectionMade(selection, queryID);
};
}
isAutoFightEndBattle = false;
GH.windows().pushWindow(wnd);
// #1490 - during AI turn when quick combat is on, we need to display the message and wait for user to close it.
// Otherwise NewTurn causes freeze.

View File

@ -87,6 +87,7 @@ public: // TODO: make private
//During battle is quick combat mode is used
std::shared_ptr<CBattleGameInterface> autofightingAI; //AI that makes decisions
bool isAutoFightOn; //Flag, switch it to stop quick combat. Don't touch if there is no battle interface.
bool isAutoFightEndBattle; //Flag, if battle forced to end with autocombat
protected: // Call-ins from server, should not be called directly, but only via GameInterface

View File

@ -754,6 +754,8 @@ void BattleWindow::endWithAutocombat()
if(!owner.makingTurn() || owner.tacticsMode)
return;
owner.curInt->isAutoFightEndBattle = true;
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
AutocombatPreferences autocombatPreferences = AutocombatPreferences();