Make sure that dialog window and screen keyboard are deleted before changing screen in lobby

This commit is contained in:
Deve 2018-09-05 23:06:29 +02:00
parent d0b24487eb
commit a60a84b05a
2 changed files with 17 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "config/user_config.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/screen_keyboard.hpp"
#include "guiengine/screen.hpp"
#include "input/device_manager.hpp"
@ -49,6 +50,7 @@ void AbstractStateManager::enterGameState()
{
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
if (getCurrentScreen() != NULL) getCurrentScreen()->tearDown();
m_menu_stack.clear();
@ -90,6 +92,7 @@ void AbstractStateManager::pushMenu(Screen* screen)
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
if (UserConfigParams::logGUI())
{
@ -122,6 +125,7 @@ void AbstractStateManager::pushScreen(Screen* screen)
{
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
if (UserConfigParams::logGUI())
{
@ -146,6 +150,7 @@ void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameS
//assert(m_game_mode != GAME);
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
if (!screen->isLoaded()) screen->loadFromFile();
std::string name = screen->getName();
@ -179,6 +184,7 @@ void AbstractStateManager::reshowTopMostMenu()
assert(m_game_mode != GAME);
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
// Send tear-down event to previous menu
if (m_menu_stack.size() > 0)
@ -243,6 +249,7 @@ void AbstractStateManager::resetAndGoToScreen(Screen* screen)
{
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
std::string name = screen->getName();
@ -271,6 +278,7 @@ void AbstractStateManager::resetAndSetStack(Screen* screens[])
assert(screens[0] != NULL);
// you need to close any dialog before calling this
assert(!ModalDialog::isADialogActive());
assert(!ScreenKeyboard::isActive());
if (m_game_mode != GAME) getCurrentScreen()->tearDown();
m_menu_stack.clear();

View File

@ -218,6 +218,10 @@ bool ClientLobby::notifyEventAsynchronous(Event* event)
//-----------------------------------------------------------------------------
void ClientLobby::addAllPlayers(Event* event)
{
// In case the user opened a user info dialog
GUIEngine::ModalDialog::dismiss();
GUIEngine::ScreenKeyboard::dismiss();
if (!checkDataSize(event, 1))
{
// If recieved invalid message for players leave now
@ -364,6 +368,7 @@ void ClientLobby::update(int ticks)
m_received_server_result = true;
// In case someone opened paused race dialog or menu in network game
GUIEngine::ModalDialog::dismiss();
GUIEngine::ScreenKeyboard::dismiss();
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
StateManager::get()->enterGameState();
World::getWorld()->enterRaceOverState();
@ -904,6 +909,10 @@ void ClientLobby::raceFinished(Event* event)
*/
void ClientLobby::exitResultScreen(Event *event)
{
// In case the user opened a user info dialog
GUIEngine::ModalDialog::dismiss();
GUIEngine::ScreenKeyboard::dismiss();
setup();
m_state.store(CONNECTED);
RaceResultGUI::getInstance()->backToLobby();