1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-17 13:41:07 +02:00

Merge pull request #601 from dydzio0614/HotseatFreezeFix2

Fix dialog showing for losing player
This commit is contained in:
Alexander Shishkin 2019-06-02 02:54:58 +03:00 committed by GitHub
commit 5ccc411971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2144,11 +2144,21 @@ void CPlayerInterface::gameOver(PlayerColor player, const EVictoryLossCheckResul
if (victoryLossCheckResult.loss())
showInfoDialog(CGI->generaltexth->allTexts[95]);
if (LOCPLINT == this)
//we assume GH.curInt == LOCPLINT
auto previousInterface = LOCPLINT; //without multiple player interfaces some of lines below are useless, but for hotseat we wanna swap player interface temporarily
LOCPLINT = this; //this is needed for dialog to show and avoid freeze, dialog showing logic should be reworked someday
GH.curInt = this; //waiting for dialogs requires this to get events
if(!makingTurn)
{
GH.curInt = this; //waiting for dialogs requires this to get events
waitForAllDialogs(); //wait till all dialogs are displayed and closed
makingTurn = true; //also needed for dialog to show with current implementation
waitForAllDialogs();
makingTurn = false;
}
else
waitForAllDialogs();
GH.curInt = previousInterface;
LOCPLINT = previousInterface;
if(CSH->howManyPlayerInterfaces() == 1 && !settings["session"]["spectate"].Bool()) //all human players eliminated
{