diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-02-13 13:54:34 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-02-15 19:54:10 +0000 |
commit | bd7c5dc246de000984f789f72b0d2d3dced6e914 (patch) | |
tree | 0f9135a9c4159eb2b1448a040cf60b5f2df913f8 | |
parent | 9424885c8e8d78230aa8de1c9083b3493a615222 (diff) | |
download | mana-bd7c5dc246de000984f789f72b0d2d3dced6e914.tar.gz mana-bd7c5dc246de000984f789f72b0d2d3dced6e914.tar.bz2 mana-bd7c5dc246de000984f789f72b0d2d3dced6e914.tar.xz mana-bd7c5dc246de000984f789f72b0d2d3dced6e914.zip |
Fixed handling of connection failure
After failure to connect it would immediately try to connect to the
chosen server, only to fail again. Now it goes back to the server choice
dialog instead.
Closes https://git.themanaworld.org/mana/mana/-/issues/86
-rw-r--r-- | src/client.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/client.cpp b/src/client.cpp index e4832a3e..dc6e9078 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -386,7 +386,13 @@ Client::Client(const Options &options): loginData.username = config.username; if (mState != STATE_ERROR) - mState = STATE_CHOOSE_SERVER; + { + // If a server was passed on the command line, or branding + // provides a server and a blank server list, we skip the + // server selection dialog. + mState = mCurrentServer.isValid() ? STATE_CONNECT_SERVER + : STATE_CHOOSE_SERVER; + } // Initialize seconds counter mSecondsCounterId = SDL_AddTimer(1000, nextSecond, nullptr); @@ -567,27 +573,12 @@ int Client::exec() case STATE_CHOOSE_SERVER: logger->log("State: CHOOSE SERVER"); - // If a server was passed on the command line, or branding - // provides a server and a blank server list, we skip the - // server selection dialog. - if (!mCurrentServer.hostname.empty() && mCurrentServer.port) - { - mState = STATE_CONNECT_SERVER; - - // Reset options so that cancelling or connect - // timeout will show the server dialog. - mOptions.serverName.clear(); - mOptions.serverPort = 0; - } - else - { - // Don't allow an alpha opacity - // lower than the default value - Theme::instance()->setMinimumOpacity(0.8f); + // Don't allow an alpha opacity + // lower than the default value + Theme::instance()->setMinimumOpacity(0.8f); - mCurrentDialog = new ServerDialog(&mCurrentServer, - mConfigDir); - } + mCurrentDialog = new ServerDialog(&mCurrentServer, + mConfigDir); break; case STATE_CONNECT_SERVER: |