Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GameOverException being shown to the user. #11972

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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