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:
parent
3e71cbcc39
commit
cad0d5db16
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user