forked from mirror/openmw-tes3mp
[Server] Update MasterClient to new protocol
This commit is contained in:
parent
6f2d12d2c6
commit
b7ab831c46
3 changed files with 10 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <RakPeerInterface.h>
|
#include <RakPeerInterface.h>
|
||||||
#include "MasterClient.hpp"
|
#include "MasterClient.hpp"
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
#include <components/openmw-mp/Version.hpp>
|
||||||
#include "Networking.hpp"
|
#include "Networking.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -69,7 +70,9 @@ MasterClient::Send(std::string hostname, std::string modname, unsigned maxPlayer
|
||||||
sstr << "\"hostname\": \"" << hostname.c_str() << "\", ";
|
sstr << "\"hostname\": \"" << hostname.c_str() << "\", ";
|
||||||
sstr << "\"modname\": \"" << modname.c_str() << "\", ";
|
sstr << "\"modname\": \"" << modname.c_str() << "\", ";
|
||||||
sstr << "\"players\": " << players << ", ";
|
sstr << "\"players\": " << players << ", ";
|
||||||
sstr << "\"max_players\": " << maxPlayers;
|
sstr << "\"max_players\": " << maxPlayers << ", ";
|
||||||
|
sstr << "\"version\": " << TES3MP_VERSION << ", ";
|
||||||
|
sstr << "\"passw\": " << mwmp::Networking::get().isPassworded();
|
||||||
sstr << "}";
|
sstr << "}";
|
||||||
mutexData.unlock();
|
mutexData.unlock();
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ void Networking::setServerPassword(std::string passw) noexcept
|
||||||
serverPassword = passw.empty() ? TES3MP_DEFAULT_PASSW : passw;
|
serverPassword = passw.empty() ? TES3MP_DEFAULT_PASSW : passw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Networking::isPassworded() const
|
||||||
|
{
|
||||||
|
return serverPassword != TES3MP_DEFAULT_PASSW;
|
||||||
|
}
|
||||||
|
|
||||||
void Networking::processPlayerPacket(RakNet::Packet *packet)
|
void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
{
|
{
|
||||||
Player *player = Players::getPlayer(packet->guid);
|
Player *player = Players::getPlayer(packet->guid);
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace mwmp
|
||||||
MasterClient *getMasterClient();
|
MasterClient *getMasterClient();
|
||||||
void InitQuery(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort);
|
void InitQuery(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort);
|
||||||
void setServerPassword(std::string passw) noexcept;
|
void setServerPassword(std::string passw) noexcept;
|
||||||
|
bool isPassworded() const;
|
||||||
|
|
||||||
static const Networking &get();
|
static const Networking &get();
|
||||||
static Networking *getPtr();
|
static Networking *getPtr();
|
||||||
|
|
Loading…
Reference in a new issue