diff options
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 15 | ||||
-rw-r--r-- | src/gui/windows/killstats.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 17 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.h | 2 |
5 files changed, 26 insertions, 16 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 70bcbcf74..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)), @@ -505,7 +510,7 @@ void CharSelectDialog::askPasswordForDeletion(const int index) // TRANSLATORS: email label. _("Enter character name:"), this, - true); + false); } mDeleteDialog->setActionEventId("try delete character"); mDeleteDialog->addActionListener(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(); } diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 09a39b6ea..210c0d2bc 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -38,9 +38,9 @@ #include "utils/gettext.h" #include "utils/performance.h" -#ifdef WIN32 +#ifdef _WIN32 #include <sys/time.h> -#endif // WIN32 +#endif // _WIN32 #include "debug.h" diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index b5be96164..c28032404 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -53,9 +53,9 @@ #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #undef ERROR -#endif // WIN32 +#endif // _WIN32 static const int MAX_SERVERLIST = 15; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 87a2b1894..3edf00009 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -431,11 +431,11 @@ void UpdaterWindow::loadNews() mScrollArea->setVerticalScrollAmount(0); } -void UpdaterWindow::loadPatch() +void UpdaterWindow::checkClientVersion() { if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } @@ -444,13 +444,17 @@ void UpdaterWindow::loadPatch() realloc(mMemoryBuffer, mDownloadedBytes + 1)); if (mMemoryBuffer == nullptr) { - logger->log1("Couldn't load patch"); + logger->log1("Couldn't check client version: null buffer"); return; } mMemoryBuffer[mDownloadedBytes] = '\0'; std::string version; + // The version check file (latest.txt) is composed of two lines: + // first, the "machine readable" version (for alphanumeric comparison) + // and second, the human readable version, to be displayed. + // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); if (line != nullptr) @@ -461,6 +465,8 @@ void UpdaterWindow::loadPatch() line = strtok(nullptr, "\n"); if (line != nullptr) { + // if you wonder why this line is above the one below, it's + // because add to top is true. mBrowserBox->addRow(strprintf("##9 Latest client version: " "##6ManaVerse %s##0", line), true); } @@ -471,7 +477,7 @@ void UpdaterWindow::loadPatch() #if defined(ANDROID) const std::string url = "androidDownloadUrl"; const std::string text = "androidDownloadUrl"; -#elif defined(WIN32) +#elif defined(_WIN32) const std::string url = "windowsDownloadUrl"; const std::string text = "windowsDownloadUrl"; #else // defined(ANDROID) @@ -825,8 +831,7 @@ void UpdaterWindow::logic() case UpdateDownloadStatus::UPDATE_PATCH: if (mDownloadComplete) { - // Parse current memory buffer as news and dispose of the data - loadPatch(); + checkClientVersion(); mUpdateHost = updateServer2 + mUpdateServerPath; mUpdatesDir = pathJoin(mUpdatesDir, "fix"); diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h index d08870e0e..7c5cc114c 100644 --- a/src/gui/windows/updaterwindow.h +++ b/src/gui/windows/updaterwindow.h @@ -106,7 +106,7 @@ class UpdaterWindow final : public Window, */ void loadNews(); - void loadPatch(); + void checkClientVersion(); void action(const ActionEvent &event) override final; |