summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogsmanager.cpp4
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_misc.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp14
-rw-r--r--src/gui/widgets/tabs/setup_visual.cpp8
-rw-r--r--src/gui/windowmanager.cpp16
-rw-r--r--src/gui/windows/charselectdialog.cpp15
-rw-r--r--src/gui/windows/killstats.cpp4
-rw-r--r--src/gui/windows/serverdialog.cpp4
-rw-r--r--src/gui/windows/updaterwindow.cpp17
-rw-r--r--src/gui/windows/updaterwindow.h2
11 files changed, 51 insertions, 41 deletions
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp
index 655ef0c2c..a33872e5e 100644
--- a/src/gui/dialogsmanager.cpp
+++ b/src/gui/dialogsmanager.cpp
@@ -57,9 +57,9 @@
#include "debug.h"
-#ifdef WIN32
+#ifdef _WIN32
#undef ERROR
-#endif // WIN32
+#endif // _WIN32
Window *deathNotice = nullptr;
DialogsManager *dialogsManager = nullptr;
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index b1847cde1..ef23dc0bc 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -51,9 +51,9 @@
#include "utils/delete2.h"
#include "utils/gettext.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <sys/time.h>
-#endif // WIN32
+#endif // _WIN32
#include <sstream>
diff --git a/src/gui/widgets/tabs/setup_misc.cpp b/src/gui/widgets/tabs/setup_misc.cpp
index ea159e8cf..f874497b7 100644
--- a/src/gui/widgets/tabs/setup_misc.cpp
+++ b/src/gui/widgets/tabs/setup_misc.cpp
@@ -563,13 +563,13 @@ Setup_Misc::Setup_Misc(const Widget2 *const widget) :
MainConfig_true);
#endif // ANDROID
-#ifndef WIN32
+#ifndef _WIN32
// TRANSLATORS: settings option
new SetupItemTextField(_("Screenshot directory"), "",
"screenshotDirectory3", this, "screenshotDirectory3Event",
MainConfig_true,
UseBase64_true);
-#endif // WIN32
+#endif // _WIN32
// TRANSLATORS: settings option
new SetupItemIntTextField(_("Network delay between sub servers"),
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index c980280e8..662e6f356 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -239,11 +239,11 @@ void Setup_Video::apply()
* See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode
*/
-#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
// checks for opengl usage
if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE)
{
-#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
if (!WindowManager::setFullScreen(fullscreen))
{
fullscreen = !fullscreen;
@@ -267,7 +267,7 @@ void Setup_Video::apply()
logger->safeError(errorMsg.str());
}
}
-#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
}
else
{
@@ -284,7 +284,7 @@ void Setup_Video::apply()
nullptr,
260);
}
-#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
config.setValue("screen", fullscreen);
}
@@ -415,7 +415,7 @@ void Setup_Video::action(const ActionEvent &event)
if (width != mainGraphics->mActualWidth
|| height != mainGraphics->mActualHeight)
{
-#if defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#if defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
if (intToRenderType(config.getIntValue("opengl"))
== RENDER_SOFTWARE)
{
@@ -459,11 +459,11 @@ void Setup_Video::action(const ActionEvent &event)
260);
}
}
-#else // defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#else // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
mainGraphics->setWindowSize(width, height);
WindowManager::doResizeVideo(width, height, false);
-#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID)
+#endif // defined(_WIN32) || defined(__APPLE__) || defined(ANDROID)
}
config.setValue("oldscreen", config.getBoolValue("screen"));
diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp
index 7f0dcdae9..4ddf7ef71 100644
--- a/src/gui/widgets/tabs/setup_visual.cpp
+++ b/src/gui/widgets/tabs/setup_visual.cpp
@@ -230,12 +230,12 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) :
"vsyncEvent", mVSyncList, 100,
MainConfig_true);
-#if defined(WIN32) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__APPLE__)
// TRANSLATORS: settings option
new SetupItemCheckBox(_("Center game window"),
"", "centerwindow", this, "centerwindowEvent",
MainConfig_true);
-#endif // defined(WIN32) || defined(__APPLE__)
+#endif // defined(_WIN32) || defined(__APPLE__)
// TRANSLATORS: settings option
new SetupItemCheckBox(_("Allow screensaver to run"),
@@ -269,7 +269,7 @@ void Setup_Visual::apply()
{
SetupTabScroll::apply();
WindowManager::applyGrabMode();
-#ifndef WIN32
+#ifndef _WIN32
WindowManager::applyScale();
-#endif // WIN32
+#endif // _WIN32
}
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index a198efe8f..a234fdd55 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -91,9 +91,9 @@ PRAGMA48(GCC diagnostic ignored "-Wshadow")
#include <SDL_image.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <SDL_syswm.h>
-#endif // WIN32
+#endif // _WIN32
PRAGMA48(GCC diagnostic pop)
#include "debug.h"
@@ -419,17 +419,17 @@ void WindowManager::setIcon()
{
#if !defined(ANDROID) && !defined(__SWITCH__)
std::string iconFile = branding.getValue("appIcon", "icons/manaplus");
-#ifdef WIN32
+#ifdef _WIN32
iconFile.append(".ico");
-#else // WIN32
+#else // _WIN32
iconFile.append(".png");
-#endif // WIN32
+#endif // _WIN32
iconFile = VirtFs::getPath(iconFile);
logger->log("Loading icon from file: %s", iconFile.c_str());
-#ifdef WIN32
+#ifdef _WIN32
static SDL_SysWMinfo pInfo;
if (mainGraphics)
SDL::getWindowWMInfo(mainGraphics->getWindow(), &pInfo);
@@ -468,7 +468,7 @@ void WindowManager::setIcon()
reinterpret_cast<LONG>(icon));
#endif // WIN64
}
-#else // WIN32
+#else // _WIN32
mIcon = MIMG_Load(iconFile.c_str());
if (mIcon != nullptr)
@@ -482,7 +482,7 @@ void WindowManager::setIcon()
SDL::SetWindowIcon(mainGraphics->getWindow(), mIcon);
}
-#endif // WIN32
+#endif // _WIN32
#endif // ANDROID
}
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;