summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-03 14:50:53 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-03 14:50:53 +0300
commitd05183a9029d65224f73143a380f1631692a9257 (patch)
treeb6666dea4c4a37c072826a6ec62955dad8812415
parentb643a5c48d53dbeca7672e3c8b5182f9d698abcb (diff)
downloadmv-d05183a9029d65224f73143a380f1631692a9257.tar.gz
mv-d05183a9029d65224f73143a380f1631692a9257.tar.bz2
mv-d05183a9029d65224f73143a380f1631692a9257.tar.xz
mv-d05183a9029d65224f73143a380f1631692a9257.zip
Convert ServerType enum into strong typed enum.
-rw-r--r--src/enums/net/servertype.h18
-rw-r--r--src/gui/windows/serverdialog.cpp4
-rw-r--r--src/net/net.cpp4
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/serverinfo.h6
5 files changed, 17 insertions, 17 deletions
diff --git a/src/enums/net/servertype.h b/src/enums/net/servertype.h
index d0ae2cdb9..09832fd77 100644
--- a/src/enums/net/servertype.h
+++ b/src/enums/net/servertype.h
@@ -23,16 +23,16 @@
#ifndef ENUMS_NET_SERVERTYPE_H
#define ENUMS_NET_SERVERTYPE_H
-namespace ServerType
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(ServerType)
{
- enum Type
- {
- UNKNOWN = 0,
- TMWATHENA,
- EVOL,
- EATHENA,
- EVOL2
- };
+ UNKNOWN = 0,
+ TMWATHENA,
+ EVOL,
+ EATHENA,
+ EVOL2
}
+enumEnd(ServerType);
#endif // ENUMS_NET_SERVERTYPE_H
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 8bd1dceb3..6290724e9 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -50,7 +50,7 @@
static const int MAX_SERVERLIST = 15;
-static std::string serverTypeToString(const ServerType::Type type)
+static std::string serverTypeToString(const ServerTypeT type)
{
switch (type)
{
@@ -80,7 +80,7 @@ static std::string serverTypeToString(const ServerType::Type type)
}
}
-static uint16_t defaultPortForServerType(const ServerType::Type type)
+static uint16_t defaultPortForServerType(const ServerTypeT type)
{
switch (type)
{
diff --git a/src/net/net.cpp b/src/net/net.cpp
index f37914966..9b31499dd 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -115,7 +115,7 @@ Net::QuestHandler *questHandler = nullptr;
namespace Net
{
-ServerType::Type networkType = ServerType::UNKNOWN;
+ServerTypeT networkType = ServerType::UNKNOWN;
std::set<int> ignorePackets;
void connectToServer(const ServerInfo &server)
@@ -173,7 +173,7 @@ void unload()
ignorePackets.clear();
}
-ServerType::Type getNetworkType()
+ServerTypeT getNetworkType()
{
return networkType;
}
diff --git a/src/net/net.h b/src/net/net.h
index ccd363b81..59a0891a2 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -36,7 +36,7 @@
namespace Net
{
-ServerType::Type getNetworkType() A_WARN_UNUSED;
+ServerTypeT getNetworkType() A_WARN_UNUSED;
/**
* Handles server detection and connection
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index e96f7d8ea..04e967581 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -34,7 +34,7 @@ class ServerInfo final
public:
typedef std::pair<int, std::string> VersionString;
- ServerType::Type type;
+ ServerTypeT type;
std::string name;
std::string hostname;
std::string althostname;
@@ -126,8 +126,8 @@ class ServerInfo final
port != other.port);
}
- static ServerType::Type parseType(const std::string &serverType)
- A_WARN_UNUSED
+ static ServerTypeT parseType(const std::string &serverType)
+ A_WARN_UNUSED
{
#ifdef TMWA_SUPPORT
if (compareStrI(serverType, "tmwathena") == 0)