mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
consider unlimited replay (or not)
This commit is contained in:
@@ -145,6 +145,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
|
|||||||
firstCall = 1; //if loading will be overwritten in serialize
|
firstCall = 1; //if loading will be overwritten in serialize
|
||||||
autosaveCount = 0;
|
autosaveCount = 0;
|
||||||
isAutoFightOn = false;
|
isAutoFightOn = false;
|
||||||
|
isAutoFightEndBattle = false;
|
||||||
ignoreEvents = false;
|
ignoreEvents = false;
|
||||||
numOfMovedArts = 0;
|
numOfMovedArts = 0;
|
||||||
}
|
}
|
||||||
@@ -782,17 +783,20 @@ void CPlayerInterface::battleEnd(const BattleID & battleID, const BattleResult *
|
|||||||
|
|
||||||
if(!battleInt)
|
if(!battleInt)
|
||||||
{
|
{
|
||||||
bool allowManualReplay = queryID != QueryID::NONE;
|
bool allowManualReplay = queryID != QueryID::NONE && !isAutoFightEndBattle;
|
||||||
|
|
||||||
auto wnd = std::make_shared<BattleResultWindow>(*br, *this, allowManualReplay);
|
auto wnd = std::make_shared<BattleResultWindow>(*br, *this, allowManualReplay);
|
||||||
|
|
||||||
if (allowManualReplay)
|
if (allowManualReplay || isAutoFightEndBattle)
|
||||||
{
|
{
|
||||||
wnd->resultCallback = [=](ui32 selection)
|
wnd->resultCallback = [=](ui32 selection)
|
||||||
{
|
{
|
||||||
cb->selectionMade(selection, queryID);
|
cb->selectionMade(selection, queryID);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAutoFightEndBattle = false;
|
||||||
|
|
||||||
GH.windows().pushWindow(wnd);
|
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.
|
// #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.
|
// Otherwise NewTurn causes freeze.
|
||||||
|
@@ -87,6 +87,7 @@ public: // TODO: make private
|
|||||||
//During battle is quick combat mode is used
|
//During battle is quick combat mode is used
|
||||||
std::shared_ptr<CBattleGameInterface> autofightingAI; //AI that makes decisions
|
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 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
|
protected: // Call-ins from server, should not be called directly, but only via GameInterface
|
||||||
|
|
||||||
|
@@ -754,6 +754,8 @@ void BattleWindow::endWithAutocombat()
|
|||||||
if(!owner.makingTurn() || owner.tacticsMode)
|
if(!owner.makingTurn() || owner.tacticsMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
owner.curInt->isAutoFightEndBattle = true;
|
||||||
|
|
||||||
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
|
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
|
||||||
|
|
||||||
AutocombatPreferences autocombatPreferences = AutocombatPreferences();
|
AutocombatPreferences autocombatPreferences = AutocombatPreferences();
|
||||||
|
Reference in New Issue
Block a user