diff options
author | cuoco <atunna2026@gmail.com> | 2024-08-08 08:59:53 +0000 |
---|---|---|
committer | cuoco <atunna2026@gmail.com> | 2024-08-08 08:59:53 +0000 |
commit | 0a72e4865107f6eaee1c842cfee448a6b791fc73 (patch) | |
tree | 12ab5258decd838a10dbdb219c4d079b422dc7ab | |
parent | 92d890fe0dc60276d81edde6d045f505d324ffba (diff) | |
download | manaverse-0a72e4865107f6eaee1c842cfee448a6b791fc73.tar.gz manaverse-0a72e4865107f6eaee1c842cfee448a6b791fc73.tar.bz2 manaverse-0a72e4865107f6eaee1c842cfee448a6b791fc73.tar.xz manaverse-0a72e4865107f6eaee1c842cfee448a6b791fc73.zip |
- Updated client.cpp to automatically select the first world and proceed to update state when settings.options.chooseDefault is true.
- This change ensures that the world selection window is bypassed for a smoother user experience when the default selection option is enabled.
- Improved logic to handle cases with only one available world and directly proceed without showing the dialog.
-rw-r--r-- | src/progs/manaplus/client.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp index d8ba7e1c2..90943812a 100644 --- a/src/progs/manaplus/client.cpp +++ b/src/progs/manaplus/client.cpp @@ -1220,21 +1220,16 @@ int Client::gameExec() // Trust that the netcode knows what it's doing mState = State::UPDATE; } - else if (worlds.size() == 1) + else if (worlds.size() == 1 || settings.options.chooseDefault) { - loginHandler->chooseServer( - 0, mCurrentServer.persistentIp); + // If there is only one world or chooseDefault is true, select the first world + loginHandler->chooseServer(0, mCurrentServer.persistentIp); mState = State::UPDATE; } else { - CREATEWIDGETV(mCurrentDialog, WorldSelectDialog, - worlds); - if (settings.options.chooseDefault) - { - static_cast<WorldSelectDialog*>(mCurrentDialog) - ->action(ActionEvent(nullptr, "ok")); - } + // Otherwise, show the world selection dialog + CREATEWIDGETV(mCurrentDialog, WorldSelectDialog, worlds); } } BLOCK_END("Client::gameExec State::WORLD_SELECT") |