Skip to content

Commit

Permalink
Fix GameOverException being shown to the user. (#11972)
Browse files Browse the repository at this point in the history
* Fix GameOverException being shown to the user.

* Fix typo.
  • Loading branch information
asvitkine authored Sep 19, 2023
1 parent 49f4fc6 commit 655a326
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,20 @@ public boolean isAi() {
public void start(final String name) {
// must call super.start
super.start(name);
try {
startImpl(name);
} catch (GameOverException e) {
// Return cleanly.
}
}

private void startImpl(final String name) {
if (getPlayerBridge().isGameOver()) {
return;
}
if (ui == null) {
// We will get here if we are loading a save game of a map that we do not have. Caller code
// should be doing
// the error handling, so just return..
// should be doing the error handling, so just return..
return;
}
// TODO: parsing which UI thing we should run based on the string name of a possibly extended
Expand All @@ -139,8 +146,7 @@ public void start(final String name) {
// the gamedata:
// (ISomeDelegate) getPlayerBridge().getRemote()
// We should never touch the game data directly. All changes to game data are done through the
// remote,
// which then changes the game using the DelegateBridge -> change factory
// remote, which then changes the game using the DelegateBridge -> change factory
ui.requiredTurnSeries(this.getGamePlayer());
enableEditModeMenu();
boolean badStep = false;
Expand Down

0 comments on commit 655a326

Please sign in to comment.