From eb19806cf592a5ed2e242594823feab676f6cb0a Mon Sep 17 00:00:00 2001 From: Dydzio Date: Sat, 1 Jun 2019 19:28:21 +0200 Subject: [PATCH] Fix dialog showing for losing player --- client/CPlayerInterface.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 08248c060..e0b45f159 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -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 {