game/ui: Fix CheckCurrentScreen check

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
This commit is contained in:
Léo Lam
2020-04-25 13:39:49 +02:00
parent fe301d4efb
commit ac45fa5124
2 changed files with 3 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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();