Skip to content

Commit

Permalink
Fix #466: Don't go to unplayable next level
Browse files Browse the repository at this point in the history
(cherry picked from commit 13207acafa90890d2ab28a05fe56f25c26d28fd7)
  • Loading branch information
SimonN committed Jun 18, 2023
1 parent 1525eb5 commit 9123d99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/game/core/game.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/menu/outcome/single.d
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
}

0 comments on commit 9123d99

Please sign in to comment.