summaryrefslogtreecommitdiff
path: root/src/net/serverinfo.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-06 18:27:23 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-06 18:27:23 +0300
commit1db4d18ed1c04548ce8414adfb4e7cf830b39279 (patch)
tree4534efeb99af72798c8074a23a4b47a5bf6b3e75 /src/net/serverinfo.h
parent088ce632451aef33f28801029aaded8c5a4c9dac (diff)
downloadplus-1db4d18ed1c04548ce8414adfb4e7cf830b39279.tar.gz
plus-1db4d18ed1c04548ce8414adfb4e7cf830b39279.tar.bz2
plus-1db4d18ed1c04548ce8414adfb4e7cf830b39279.tar.xz
plus-1db4d18ed1c04548ce8414adfb4e7cf830b39279.zip
Move servertype enum into separate file.
Diffstat (limited to 'src/net/serverinfo.h')
-rw-r--r--src/net/serverinfo.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index 35e40e889..a1b0c5b41 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -23,6 +23,8 @@
#ifndef NET_SERVERINFO_H
#define NET_SERVERINFO_H
+#include "enums/net/servertype.h"
+
#include "utils/stringutils.h"
#include <SDL_stdinc.h>
@@ -35,18 +37,9 @@
class ServerInfo final
{
public:
- enum Type
- {
- UNKNOWN = 0,
- TMWATHENA,
- EVOL,
- EATHENA,
- EVOL2
- };
-
typedef std::pair<int, std::string> VersionString;
- Type type;
+ ServerType::Type type;
std::string name;
std::string hostname;
std::string althostname;
@@ -61,7 +54,7 @@ class ServerInfo final
bool persistentIp;
ServerInfo() :
- type(TMWATHENA),
+ type(ServerType::TMWATHENA),
name(),
hostname(),
althostname(),
@@ -103,12 +96,14 @@ class ServerInfo final
bool isValid() const A_WARN_UNUSED
{
- return !(hostname.empty() || port == 0 || type == UNKNOWN);
+ return !(hostname.empty()
+ || port == 0
+ || type == ServerType::UNKNOWN);
}
void clear()
{
- type = UNKNOWN;
+ type = ServerType::UNKNOWN;
name.clear();
hostname.clear();
althostname.clear();
@@ -136,30 +131,31 @@ class ServerInfo final
port != other.port);
}
- static Type parseType(const std::string &serverType) A_WARN_UNUSED
+ static ServerType::Type parseType(const std::string &serverType)
+ A_WARN_UNUSED
{
#ifdef TMWA_SUPPORT
if (compareStrI(serverType, "tmwathena") == 0)
- return TMWATHENA;
+ return ServerType::TMWATHENA;
if (compareStrI(serverType, "evol") == 0)
- return EVOL;
+ return ServerType::EVOL;
#else
if (compareStrI(serverType, "tmwathena") == 0
|| compareStrI(serverType, "evol") == 0)
- return EATHENA;
+ return ServerType::EATHENA;
#endif
#ifdef EATHENA_SUPPORT
else if (compareStrI(serverType, "eathena") == 0)
- return EATHENA;
+ return ServerType::EATHENA;
else if (compareStrI(serverType, "evol2") == 0)
- return EVOL2;
+ return ServerType::EVOL2;
#else
else if (compareStrI(serverType, "eathena") == 0)
- return TMWATHENA;
+ return ServerType::TMWATHENA;
else if (compareStrI(serverType, "evol2") == 0)
- return TMWATHENA;
+ return ServerType::TMWATHENA;
#endif
- return UNKNOWN;
+ return ServerType::UNKNOWN;
}
};