From 0a72e4865107f6eaee1c842cfee448a6b791fc73 Mon Sep 17 00:00:00 2001 From: cuoco Date: Thu, 8 Aug 2024 08:59:53 +0000 Subject: fix: Skip world select dialog when chooseDefault (-D) is enabled - 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. --- src/progs/manaplus/client.cpp | 15 +++++---------- 1 file 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(mCurrentDialog) - ->action(ActionEvent(nullptr, "ok")); - } + // Otherwise, show the world selection dialog + CREATEWIDGETV(mCurrentDialog, WorldSelectDialog, worlds); } } BLOCK_END("Client::gameExec State::WORLD_SELECT") -- cgit v1.2.3-70-g09d2