2017-04-23 05:36:47 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 22.04.17.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketMasterUpdate.hpp"
|
|
|
|
#include "ProxyMasterPacket.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
using namespace std;
|
|
|
|
using namespace RakNet;
|
|
|
|
|
|
|
|
PacketMasterUpdate::PacketMasterUpdate(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_MASTER_UPDATE;
|
|
|
|
orderChannel = CHANNEL_MASTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PacketMasterUpdate::Packet(RakNet::BitStream *bs, bool send)
|
|
|
|
{
|
|
|
|
this->bs = bs;
|
|
|
|
if (send)
|
|
|
|
bs->Write(packetID);
|
|
|
|
|
2017-05-20 08:46:59 +00:00
|
|
|
string addr = server->first.ToString(false);
|
|
|
|
unsigned short port = server->first.GetPort();
|
|
|
|
|
|
|
|
RW(addr, send);
|
|
|
|
RW(port, send);
|
|
|
|
|
2017-05-31 05:37:11 +00:00
|
|
|
if (!send)
|
2017-05-20 08:46:59 +00:00
|
|
|
server->first = SystemAddress(addr.c_str(), port);
|
2017-04-23 05:36:47 +00:00
|
|
|
|
|
|
|
ProxyMasterPacket::addServer(this, server->second, send);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-04-24 11:58:48 +00:00
|
|
|
void PacketMasterUpdate::SetServer(std::pair<RakNet::SystemAddress, QueryData> *serverPair)
|
2017-04-23 05:36:47 +00:00
|
|
|
{
|
|
|
|
server = serverPair;
|
|
|
|
}
|