summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcuoco <atunna2026@gmail.com>2024-08-08 08:59:53 +0000
committercuoco <atunna2026@gmail.com>2024-08-08 08:59:53 +0000
commit0a72e4865107f6eaee1c842cfee448a6b791fc73 (patch)
tree12ab5258decd838a10dbdb219c4d079b422dc7ab /src
parent92d890fe0dc60276d81edde6d045f505d324ffba (diff)
downloadmanaverse-master.tar.gz
manaverse-master.tar.bz2
manaverse-master.tar.xz
manaverse-master.zip
fix: Skip world select dialog when chooseDefault (-D) is enabledHEADmaster
- 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.
Diffstat (limited to 'src')
-rw-r--r--src/progs/manaplus/client.cpp15
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")