summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-02 21:57:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-02 22:00:37 +0300
commiteca890c92d3b43b8aae5f2c53cab49612f5efd1d (patch)
tree8acbdfe972044adcfbcc5a6bf7ea28b4bbb54382 /src/net
parent520a495c466793c29f3e721634dfe6cc616b8ede (diff)
downloadmv-eca890c92d3b43b8aae5f2c53cab49612f5efd1d.tar.gz
mv-eca890c92d3b43b8aae5f2c53cab49612f5efd1d.tar.bz2
mv-eca890c92d3b43b8aae5f2c53cab49612f5efd1d.tar.xz
mv-eca890c92d3b43b8aae5f2c53cab49612f5efd1d.zip
Add option "use same ip" for each server.
By default all servers using same ip for subservers.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/charserverhandler.cpp2
-rw-r--r--src/net/ea/loginhandler.cpp5
-rw-r--r--src/net/ea/loginhandler.h3
-rw-r--r--src/net/loginhandler.h3
-rw-r--r--src/net/serverinfo.h9
5 files changed, 14 insertions, 8 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index d541ce09b..849fe15e1 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -242,7 +242,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &restrict msg,
PlayerInfo::setCharId(msg.readInt32());
GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler());
gh->setMap(msg.readString(16));
- if (config.getBoolValue("usePersistentIP"))
+ if (config.getBoolValue("usePersistentIP") || client->getPersistentIp())
{
msg.readInt32();
server.hostname = client->getServerName();
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index af86aaf93..d4cf0e59e 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -75,7 +75,8 @@ void LoginHandler::loginAccount(LoginData *const loginData1) const
}
}
-void LoginHandler::chooseServer(const unsigned int server) const
+void LoginHandler::chooseServer(const unsigned int server,
+ const bool persistentIp) const
{
if (server >= mWorlds.size() || !mWorlds[server])
return;
@@ -83,7 +84,7 @@ void LoginHandler::chooseServer(const unsigned int server) const
ServerInfo *const charServer = getCharServer();
if (charServer)
{
- if (config.getBoolValue("usePersistentIP"))
+ if (config.getBoolValue("usePersistentIP") || persistentIp)
charServer->hostname = client->getServerName();
else
charServer->hostname = ipToString(mWorlds[server]->address);
diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h
index 8619d4c34..d8bffc0be 100644
--- a/src/net/ea/loginhandler.h
+++ b/src/net/ea/loginhandler.h
@@ -61,7 +61,8 @@ class LoginHandler : public Net::LoginHandler
virtual void loginAccount(LoginData *const loginData)
const override final;
- virtual void chooseServer(const unsigned int server) const override;
+ virtual void chooseServer(const unsigned int server,
+ const bool persistentIp) const override;
virtual void registerAccount(const LoginData *const loginData)
const override final;
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index caad082ae..b00ffffe2 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -88,7 +88,8 @@ class LoginHandler
const std::string &restrict newPassword)
const = 0;
- virtual void chooseServer(unsigned int server) const = 0;
+ virtual void chooseServer(unsigned int server,
+ const bool persistentIp) const = 0;
virtual void registerAccount(const LoginData *const loginData)
const = 0;
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index 899400598..b2cd652bb 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -55,8 +55,8 @@ public:
std::string supportUrl;
uint16_t port;
VersionString version;
-
bool save;
+ bool persistentIp;
ServerInfo() :
type(TMWATHENA),
@@ -69,7 +69,8 @@ public:
supportUrl(),
port(6901),
version(),
- save(false)
+ save(false),
+ persistentIp(true)
{
version.first = 0;
}
@@ -85,7 +86,8 @@ public:
supportUrl(info.supportUrl),
port(info.port),
version(),
- save(info.save)
+ save(info.save),
+ persistentIp(info.persistentIp)
{
version.first = info.version.first;
version.second = info.version.second;
@@ -110,6 +112,7 @@ public:
version.first = 0;
version.second.clear();
save = false;
+ persistentIp = true;
}
bool operator==(const ServerInfo &other) const