summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-20 13:26:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-20 13:26:40 +0300
commit6bf4a5aa68afb7d95632880c001286f2a721e1f5 (patch)
tree3bfde7b41153e43b7057e92e37bdc87c38d503cb /src
parent0369cb5dc2e5dae4acdb0753c3b309ef874c96ae (diff)
downloadmanaverse-6bf4a5aa68afb7d95632880c001286f2a721e1f5.tar.gz
manaverse-6bf4a5aa68afb7d95632880c001286f2a721e1f5.tar.bz2
manaverse-6bf4a5aa68afb7d95632880c001286f2a721e1f5.tar.xz
manaverse-6bf4a5aa68afb7d95632880c001286f2a721e1f5.zip
Move updatetype into separate file.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/client.cpp2
-rw-r--r--src/gui/windows/logindialog.cpp6
-rw-r--r--src/gui/windows/updaterwindow.cpp2
-rw-r--r--src/net/logindata.h12
-rw-r--r--src/net/updatetype.h37
7 files changed, 47 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8d3762bc9..4480067e5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -503,6 +503,7 @@ SET(SRCS
net/serverinfo.h
net/skillhandler.h
net/tradehandler.h
+ net/updatetype.h
net/worldinfo.h
net/packetcounters.cpp
net/packetcounters.h
diff --git a/src/Makefile.am b/src/Makefile.am
index fcfad6e59..5a2ce04af 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -615,6 +615,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
net/serverinfo.h \
net/skillhandler.h \
net/tradehandler.h \
+ net/updatetype.h \
net/worldinfo.h \
net/packetcounters.cpp \
net/packetcounters.h \
diff --git a/src/client.cpp b/src/client.cpp
index 2217314c4..097e1641b 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1373,7 +1373,7 @@ int Client::gameExec()
mOldUpdates = "";
UpdaterWindow::loadDirMods(mOptions.dataPath);
}
- else if (loginData.updateType & LoginData::Upd_Skip)
+ else if (loginData.updateType & UpdateType::Skip)
{
mOldUpdates = mLocalDataDir
+ dirSeparator + mUpdatesDir;
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 101f547f0..83041bc75 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -84,7 +84,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mRegisterButton(new Button(this, _("Register"), "register", this)),
// TRANSLATORS: login dialog checkbox
mCustomUpdateHost(new CheckBox(this, _("Custom update host"),
- mLoginData->updateType & LoginData::Upd_Custom, this, "customhost")),
+ mLoginData->updateType & UpdateType::Custom, this, "customhost")),
mUpdateHostText(new TextField(this, serverConfig.getValue(
"customUpdateHost", ""))),
mUpdateListModel(nullptr),
@@ -129,7 +129,7 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateTypeDropDown->setActionEventId("updatetype");
mUpdateTypeDropDown->setSelected((mLoginData->updateType
- | LoginData::Upd_Custom) ^ LoginData::Upd_Custom);
+ | UpdateType::Custom) ^ UpdateType::Custom);
if (!mCustomUpdateHost->isSelected())
mUpdateHostText->setVisible(false);
@@ -277,7 +277,7 @@ void LoginDialog::prepareUpdate()
if (mCustomUpdateHost->isSelected()
&& !mUpdateHostText->getText().empty())
{
- updateType |= LoginData::Upd_Custom;
+ updateType |= UpdateType::Custom;
serverConfig.setValue("customUpdateHost",
mUpdateHostText->getText());
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 4e0f609ac..898d50425 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -275,7 +275,7 @@ void UpdaterWindow::enable()
mPlayButton->setEnabled(true);
mPlayButton->requestFocus();
- if (mUpdateType & LoginData::Upd_Close)
+ if (mUpdateType & UpdateType::Close)
client->setState(STATE_LOAD_DATA);
}
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 69dbfbb66..6e7c285c0 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -27,6 +27,8 @@
#include "utils/stringvector.h"
+#include "net/updatetype.h"
+
#include <string>
#include "localconsts.h"
@@ -54,14 +56,6 @@ class LoginData final
A_DELETE_COPY(LoginData)
- enum UpdateType
- {
- Upd_Normal = 0,
- Upd_Close = 1,
- Upd_Skip = 2,
- Upd_Custom = 4
- };
-
std::string username;
std::string password;
std::string newPassword;
@@ -88,7 +82,7 @@ class LoginData final
newPassword.clear();
updateHost.clear();
updateHosts.clear();
- updateType = Upd_Normal;
+ updateType = UpdateType::Normal;
email.clear();
captchaResponse.clear();
registerUrl.clear();
diff --git a/src/net/updatetype.h b/src/net/updatetype.h
new file mode 100644
index 000000000..7f28058c4
--- /dev/null
+++ b/src/net/updatetype.h
@@ -0,0 +1,37 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_UPDATETYPE_H
+#define NET_UPDATETYPE_H
+
+namespace UpdateType
+{
+ enum Type
+ {
+ Normal = 0,
+ Close = 1,
+ Skip = 2,
+ Custom = 4
+ };
+} // namespace UpdateType
+
+#endif // NET_UPDATETYPE_H