From 9123d995aec19c453af47a36c91f7c2d38ab076f Mon Sep 17 00:00:00 2001 From: Simon Naarmann Date: Sun, 18 Jun 2023 01:20:55 +0200 Subject: [PATCH] Fix #466: Don't go to unplayable next level (cherry picked from commit 13207acafa90890d2ab28a05fe56f25c26d28fd7) --- src/game/core/game.d | 3 ++- src/menu/outcome/single.d | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/core/game.d b/src/game/core/game.d index 45b45d81..7467df7b 100644 --- a/src/game/core/game.d +++ b/src/game/core/game.d @@ -108,7 +108,8 @@ public: this(ArgsToCreateGame args) in { assert (args.level !is null); - assert (args.level.playable); + assert (args.level.playable, + "Level is not playable. Don't create a Game for this."); assert (args.levelFilename !is null); } do { diff --git a/src/menu/outcome/single.d b/src/menu/outcome/single.d index 8988a3b8..dd17c957 100644 --- a/src/menu/outcome/single.d +++ b/src/menu/outcome/single.d @@ -221,5 +221,10 @@ public: return _nextLevel; } + override bool execute() const pure nothrow @safe @nogc + { + return super.execute && _nextLevel.level.playable; + } + void dispose() { _preview.dispose(); } }