Skip to content

Commit

Permalink
game/ui: Fix CheckCurrentScreen check
Browse files Browse the repository at this point in the history
This changes ui::CheckCurrentScreen to also check that the screen is
not closing, which fixes a softlock in the Bomber's Notebook if
the map is opened while the screen is closing.

Closes #129
  • Loading branch information
leoetlino committed Apr 25, 2020
1 parent fe301d4 commit ac45fa5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/game/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ bool OpenScreen(ScreenType screen) {
}

bool CheckCurrentScreen(ScreenType screen) {
return GetScreenContext().active_screen == GetScreen(screen);
auto& ctx = GetScreenContext();
return ctx.active_screen == GetScreen(screen) && !ctx.new_screen;
}

void LayoutBase::calc(float speed) {
Expand Down
1 change: 1 addition & 0 deletions source/game/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum class ScreenType {
};
Screen* GetScreen(ScreenType screen);
bool OpenScreen(ScreenType screen);
/// Check whether the specified screen is active and not closing.
bool CheckCurrentScreen(ScreenType screen);

ScreenContext& GetScreenContext();
Expand Down

0 comments on commit ac45fa5

Please sign in to comment.