[General] Switch to new official master server port when using old one

This commit is contained in:
David Cernat 2018-08-22 13:49:17 +03:00
parent 0658d39eaa
commit d1fa57ac14
2 changed files with 13 additions and 0 deletions

View file

@ -36,6 +36,11 @@ int main(int argc, char *argv[])
std::string addr = mgr.getString("address", "Master");
int port = mgr.getInt("port", "Master");
// Is this an attempt to connect to the official master server at the old port? If so,
// redirect it to the correct port for the currently used fork of RakNet
if (Misc::StringUtils::ciEqual(addr, "master.tes3mp.com") && port == 25560)
port = 25561;
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);

View file

@ -292,6 +292,14 @@ int main(int argc, char *argv[])
int masterPort = mgr.getInt("port", "MasterServer");
int updateRate = mgr.getInt("rate", "MasterServer");
// Is this an attempt to connect to the official master server at the old port? If so,
// redirect it to the correct port for the currently used fork of RakNet
if (Misc::StringUtils::ciEqual(masterAddr, "master.tes3mp.com") && masterPort == 25560)
{
LOG_APPEND(Log::LOG_INFO, "- switching to port 25561 because the correct official master server for this version is on that port");
masterPort = 25561;
}
networking.InitQuery(masterAddr, (unsigned short) masterPort);
networking.getMasterClient()->SetMaxPlayers((unsigned) players);
networking.getMasterClient()->SetUpdateRate((unsigned) updateRate);