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

Fix dialog showing for losing player

This commit is contained in:
Dydzio 2019-06-01 19:28:21 +02:00 committed by GitHub
parent 54bbf2abb3
commit eb19806cf5
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()) if (victoryLossCheckResult.loss())
showInfoDialog(CGI->generaltexth->allTexts[95]); 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 makingTurn = true; //also needed for dialog to show with current implementation
waitForAllDialogs(); //wait till all dialogs are displayed and closed waitForAllDialogs();
makingTurn = false;
} }
else
waitForAllDialogs();
GH.curInt = previousInterface;
LOCPLINT = previousInterface;
if(CSH->howManyPlayerInterfaces() == 1 && !settings["session"]["spectate"].Bool()) //all human players eliminated if(CSH->howManyPlayerInterfaces() == 1 && !settings["session"]["spectate"].Bool()) //all human players eliminated
{ {