Skip to content

Commit

Permalink
fix enemy giving up message being shown multiple times
Browse files Browse the repository at this point in the history
happended when eding the turn via the "forgotten to do your moves" idalog
  • Loading branch information
Sesu8642 committed Mar 8, 2023
1 parent 7103128 commit fccb7d4
Showing 1 changed file with 10 additions and 6 deletions.
Expand Up @@ -142,17 +142,21 @@ public void handleEndTurnAttempt() {
&& mainPrefsDao.getMainPreferences().isWarnAboutForgottenKingdoms()) {
Dialog confirmDialog = dialogFactory.createConfirmDialog(
"You might have forgotten to do your moves for a kingdom.\nAre you sure you want to end your turn?\n",
() -> eventBus.post(new EndTurnEvent()));
this::endHumanPlayerTurn);
confirmDialog.show(hudStage);
} else {
winnerBeforeBotTurn = cachedGameState.getWinner();
// isLocalPlayerTurn needs to be set here because if the bot turns are not
// shown, this class would never notice that a bot player was active
isLocalPlayerTurn = false;
eventBus.post(new EndTurnEvent());
endHumanPlayerTurn();
}
}

private void endHumanPlayerTurn() {
winnerBeforeBotTurn = cachedGameState.getWinner();
// isLocalPlayerTurn needs to be set here because if the bot turns are not
// shown, this class would never notice that a bot player was active
isLocalPlayerTurn = false;
eventBus.post(new EndTurnEvent());
}

/** Displays a warning about lost progress and resets the game if confirmed. */
void handleUnconfirmedRetryGame() {
Dialog confirmDialog = dialogFactory.createConfirmDialog("Your progress will be lost. Are you sure?\n",
Expand Down

0 comments on commit fccb7d4

Please sign in to comment.