[Server] Update MasterClient to new protocol

This commit is contained in:
Koncord 2017-02-20 23:14:59 +08:00
parent 6f2d12d2c6
commit b7ab831c46
3 changed files with 10 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include <RakPeerInterface.h>
#include "MasterClient.hpp"
#include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/Version.hpp>
#include "Networking.hpp"
using namespace std;
@ -69,7 +70,9 @@ MasterClient::Send(std::string hostname, std::string modname, unsigned maxPlayer
sstr << "\"hostname\": \"" << hostname.c_str() << "\", ";
sstr << "\"modname\": \"" << modname.c_str() << "\", ";
sstr << "\"players\": " << players << ", ";
sstr << "\"max_players\": " << maxPlayers;
sstr << "\"max_players\": " << maxPlayers << ", ";
sstr << "\"version\": " << TES3MP_VERSION << ", ";
sstr << "\"passw\": " << mwmp::Networking::get().isPassworded();
sstr << "}";
mutexData.unlock();

View file

@ -64,6 +64,11 @@ void Networking::setServerPassword(std::string passw) noexcept
serverPassword = passw.empty() ? TES3MP_DEFAULT_PASSW : passw;
}
bool Networking::isPassworded() const
{
return serverPassword != TES3MP_DEFAULT_PASSW;
}
void Networking::processPlayerPacket(RakNet::Packet *packet)
{
Player *player = Players::getPlayer(packet->guid);

View file

@ -41,6 +41,7 @@ namespace mwmp
MasterClient *getMasterClient();
void InitQuery(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort);
void setServerPassword(std::string passw) noexcept;
bool isPassworded() const;
static const Networking &get();
static Networking *getPtr();