forked from mirror/openmw-tes3mp
[General] Minor fixes in Master packets
This commit is contained in:
parent
2f6e3b4cda
commit
647661daf9
7 changed files with 23 additions and 20 deletions
|
@ -35,7 +35,7 @@ void PacketMasterAnnounce::SetServer(QueryData *_server)
|
|||
server = _server;
|
||||
}
|
||||
|
||||
void PacketMasterAnnounce::SetFunc(int _func)
|
||||
void PacketMasterAnnounce::SetFunc(uint32_t _func)
|
||||
{
|
||||
func = _func;
|
||||
}
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace mwmp
|
|||
{
|
||||
friend class ProxyMasterPacket;
|
||||
public:
|
||||
PacketMasterAnnounce(RakNet::RakPeerInterface *peer);
|
||||
explicit PacketMasterAnnounce(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
void Packet(RakNet::BitStream *bs, bool send) override;
|
||||
|
||||
void SetServer(QueryData *server);
|
||||
void SetFunc(int keep);
|
||||
void SetFunc(uint32_t keep);
|
||||
int GetFunc();
|
||||
|
||||
enum Func
|
||||
|
@ -31,7 +31,7 @@ namespace mwmp
|
|||
};
|
||||
private:
|
||||
QueryData *server;
|
||||
int func;
|
||||
uint32_t func;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
|
|||
if (send)
|
||||
bs->Write(packetID);
|
||||
|
||||
int serversCount = servers->size();
|
||||
int32_t serversCount = servers->size();
|
||||
|
||||
RW(serversCount, send);
|
||||
|
||||
|
@ -36,7 +36,7 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
|
|||
|
||||
QueryData server;
|
||||
string addr;
|
||||
unsigned short port;
|
||||
uint16_t port;
|
||||
while (serversCount--)
|
||||
{
|
||||
if (send)
|
||||
|
@ -50,6 +50,12 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
|
|||
|
||||
ProxyMasterPacket::addServer(this, server, send);
|
||||
|
||||
if(addr.empty())
|
||||
{
|
||||
cout << "Address empty. Aborting PacketMasterQuery::Packet" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (send)
|
||||
serverIt++;
|
||||
else
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace mwmp
|
|||
{
|
||||
friend class ProxyMasterPacket;
|
||||
public:
|
||||
PacketMasterQuery(RakNet::RakPeerInterface *peer);
|
||||
explicit PacketMasterQuery(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
void Packet(RakNet::BitStream *bs, bool send) override;
|
||||
|
||||
void SetServers(std::map<RakNet::SystemAddress, QueryData> *serverMap);
|
||||
private:
|
||||
|
|
|
@ -24,7 +24,7 @@ void PacketMasterUpdate::Packet(RakNet::BitStream *bs, bool send)
|
|||
bs->Write(packetID);
|
||||
|
||||
string addr = server->first.ToString(false);
|
||||
unsigned short port = server->first.GetPort();
|
||||
uint16_t port = server->first.GetPort();
|
||||
|
||||
RW(addr, send);
|
||||
RW(port, send);
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace mwmp
|
|||
{
|
||||
friend class ProxyMasterPacket;
|
||||
public:
|
||||
PacketMasterUpdate(RakNet::RakPeerInterface *peer);
|
||||
explicit PacketMasterUpdate(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
void Packet(RakNet::BitStream *bs, bool send) override;
|
||||
|
||||
void SetServer(std::pair<RakNet::SystemAddress, QueryData> *serverPair);
|
||||
private:
|
||||
|
|
|
@ -14,9 +14,8 @@ namespace mwmp
|
|||
class ProxyMasterPacket : public BasePacket
|
||||
{
|
||||
private:
|
||||
ProxyMasterPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
||||
explicit ProxyMasterPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -25,8 +24,7 @@ namespace mwmp
|
|||
{
|
||||
using namespace std;
|
||||
|
||||
int rulesSize = server.rules.size();
|
||||
|
||||
int32_t rulesSize = server.rules.size();
|
||||
packet->RW(rulesSize, send);
|
||||
|
||||
if (rulesSize > 2000)
|
||||
|
@ -38,7 +36,7 @@ namespace mwmp
|
|||
|
||||
while (rulesSize--)
|
||||
{
|
||||
ServerRule *rule = 0;
|
||||
ServerRule *rule = nullptr;
|
||||
string key;
|
||||
if (send)
|
||||
{
|
||||
|
@ -71,9 +69,8 @@ namespace mwmp
|
|||
else
|
||||
server.players.clear();
|
||||
|
||||
int playersCount = server.players.size();
|
||||
int32_t playersCount = server.players.size();
|
||||
packet->RW(playersCount, send);
|
||||
|
||||
if (playersCount > 2000)
|
||||
playersCount = 0;
|
||||
|
||||
|
@ -91,7 +88,7 @@ namespace mwmp
|
|||
plIt++;
|
||||
}
|
||||
|
||||
int pluginsCount = server.plugins.size();
|
||||
int32_t pluginsCount = server.plugins.size();
|
||||
packet->RW(pluginsCount, send);
|
||||
|
||||
if (pluginsCount > 2000)
|
||||
|
|
Loading…
Reference in a new issue