diff options
Diffstat (limited to 'src/gui/windows/charselectdialog.cpp')
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 77e224f7a..c7a2e0eef 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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)), @@ -102,15 +107,11 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : placer = getPlacer(0, 0); // disable logout using -S + int column = 0; if (!settings.options.uniqueSession) - { - placer(0, 0, mSwitchLoginButton, 1, 1); - } - int n = 1; - placer(n, 0, mChangePasswordButton, 1, 1); - n ++; - placer(n, 0, mDeleteButton, 1, 1); - n ++; + placer(column++, 0, mSwitchLoginButton, 1, 1); + placer(column++, 0, mChangePasswordButton, 1, 1); + placer(column++, 0, mDeleteButton, 1, 1); #ifdef TMWA_SUPPORT if (Net::getNetworkType() != ServerType::TMWATHENA) #endif @@ -121,8 +122,7 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : "rename", BUTTON_SKIN, this); - placer(n, 0, mRenameButton, 1, 1); - n ++; + placer(column++, 0, mRenameButton, 1, 1); } #ifdef TMWA_SUPPORT if (serverFeatures->havePincode()) @@ -134,11 +134,9 @@ CharSelectDialog::CharSelectDialog(LoginData &data) : "changepin", BUTTON_SKIN, this); - placer(n, 0, mChangePinButton, 1, 1); - n ++; + placer(column++, 0, mChangePinButton, 1, 1); } - placer(n, 0, mInfoButton, 1, 1); - n ++; + placer(column++, 0, mInfoButton, 1, 1); for (int i = 0; i < CAST_S32(mLoginData->characterSlots); i++) { @@ -314,12 +312,16 @@ void CharSelectDialog::action(const ActionEvent &event) return; if ((mDeleteDialog != nullptr) && mDeleteIndex != -1) { + const Net::Character *const character + = mCharacterEntries[mDeleteIndex]->getCharacter(); if (serverFeatures->haveEmailOnDelete()) { attemptCharacterDelete(mDeleteIndex, mDeleteDialog->getText()); mDeleteDialog = nullptr; } - else if (mDeleteDialog->getText() == LoginDialog::savedPassword) + else if (character != nullptr && + character->dummy != nullptr && + mDeleteDialog->getText() == character->dummy->getName()) { attemptCharacterDelete(mDeleteIndex, ""); mDeleteDialog = nullptr; @@ -330,7 +332,7 @@ void CharSelectDialog::action(const ActionEvent &event) // TRANSLATORS: error header _("Error"), // TRANSLATORS: error message - _("Incorrect password"), + _("Incorrect character name"), // TRANSLATORS: ok dialog button _("OK"), DialogType::ERROR, @@ -504,11 +506,11 @@ void CharSelectDialog::askPasswordForDeletion(const int index) { CREATEWIDGETV(mDeleteDialog, TextDialog, // TRANSLATORS: char deletion question. - _("Enter password for deleting character"), + _("Enter character name to confirm deleting the character"), // TRANSLATORS: email label. - _("Enter password:"), + _("Enter character name:"), this, - true); + false); } mDeleteDialog->setActionEventId("try delete character"); mDeleteDialog->addActionListener(this); @@ -623,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(); } |