summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorasuratva <asuratva@proton.me>2025-07-04 15:38:17 +0000
committerFedja Beader <fedja@protonmail.ch>2025-07-04 15:38:17 +0000
commitffe75331a1a61331778206b5943a9847aaa0376b (patch)
tree6acee67cb4ba7792a2a9eb71ebfa3bba755827d8 /src/gui
parentba796ccc028f78e36a6e07249698541d8cc411de (diff)
downloadplus-master.tar.gz
plus-master.tar.bz2
plus-master.tar.xz
plus-master.zip
Fix 'Switch' Button in Character Selection to automatically become 'World Selection' or 'Logout'HEADmaster
This is a suggested fix for !188 Squashed with: * Added new state SWITCH_WORLD. Now everything works correctly. * As a temporary fix, have 'Change Login' in World Selection Dialog do SWITCH_SERVER instead of SWITCH_LOGIN * Move 'Switch World' logic from charselectdialog to SWITCH_LOGIN state * reverting previous commit. State needs to be LOGIN_ATTEMPT, not LOGIN. * Have 'Switch World' set client state to LOGIN instead of LOGIN_ATTEMPT Not strictly necesssary, but LOGIN provides some extra sanity checks before switch to LOGIN_ATTEMPT * Got it working! Purely from client side, but horribly hacky solution! * fixing linter issue. Hopefully it works, otherwise might need to make an extra commit **** mana/verse!191 Reviewed-by: Fedja Beader <fedja@protonmail.ch>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/charselectdialog.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 3ee5e5218..c7a2e0eef 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -47,6 +47,7 @@
#include "net/character.h"
#include "net/charserverhandler.h"
#include "net/logindata.h"
+#include "net/loginhandler.h"
#ifdef TMWA_SUPPORT
#include "net/net.h"
#endif // TMWA_SUPPORT
@@ -71,9 +72,13 @@ CharSelectDialog::CharSelectDialog(LoginData &data) :
ActionListener(),
KeyListener(),
mLoginData(&data),
- // TRANSLATORS: char select dialog. button.
- mSwitchLoginButton(new Button(this, _("Switch"), "switch",
- BUTTON_SKIN, this)),
+ mSwitchLoginButton(new Button(this,
+ (loginHandler != nullptr && loginHandler->getWorlds().size() > 1)
+ // TRANSLATORS: char select dialog. button.
+ ? _("Switch World") : _("Logout"),
+ "switch",
+ BUTTON_SKIN,
+ this)),
// TRANSLATORS: char select dialog. button.
mChangePasswordButton(new Button(this, _("Password"), "change_password",
BUTTON_SKIN, this)),
@@ -620,7 +625,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
void CharSelectDialog::close()
{
- client->setState(State::SWITCH_LOGIN);
+ client->setState(State::SWITCH_WORLD);
Window::close();
}