diff options
Diffstat (limited to 'src/gui/windows/updaterwindow.cpp')
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index ff194ada4..9835279cc 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -276,8 +276,15 @@ void UpdaterWindow::enable() mPlayButton->setEnabled(true); mPlayButton->requestFocus(); - if (mUpdateType & UpdateType::Close) - client->setState(STATE_LOAD_DATA); + if (client->getState() != STATE_GAME) + { + if (mUpdateType & UpdateType::Close) + client->setState(STATE_LOAD_DATA); + } + else + { + deleteSelf(); + } } void UpdaterWindow::action(const ActionEvent &event) @@ -296,7 +303,10 @@ void UpdaterWindow::action(const ActionEvent &event) } else if (eventId == "play") { - client->setState(STATE_LOAD_DATA); + if (client->getState() != STATE_GAME) + client->setState(STATE_LOAD_DATA); + else + deleteSelf(); } } @@ -306,7 +316,10 @@ void UpdaterWindow::keyPressed(KeyEvent &event) if (actionId == static_cast<int>(InputAction::GUI_CANCEL)) { action(ActionEvent(nullptr, mCancelButton->getActionEventId())); - client->setState(STATE_LOGIN); + if (client->getState() != STATE_GAME) + client->setState(STATE_LOGIN); + else + deleteSelf(); } else if (actionId == static_cast<int>(InputAction::GUI_SELECT) || actionId == static_cast<int>(InputAction::GUI_SELECT2)) @@ -503,7 +516,8 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus::Type status, uw->setProgress(progress); - if (client->getState() != STATE_UPDATE + if ((client->getState() != STATE_UPDATE + && client->getState() != STATE_GAME) || uw->mDownloadStatus == UPDATE_ERROR) { // If the action was canceled return an error code to stop the mThread @@ -1134,3 +1148,9 @@ void UpdaterWindow::unloadMods(const std::string &dir) } } } + +void UpdaterWindow::deleteSelf() +{ + scheduleDelete(); + updaterWindow = nullptr; +} |