[General] Use simple types for master server packets

0.6.1
Koncord 8 years ago
parent b0cd636924
commit 80bd268de6

@ -34,22 +34,25 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
serverIt = servers->begin(); serverIt = servers->begin();
QueryData server; QueryData server;
SystemAddress sa; string addr;
unsigned short port;
while(serversCount--) while(serversCount--)
{ {
if (send) if (send)
{ {
sa = serverIt->first; addr = serverIt->first.ToString(false);
port = serverIt->first.GetPort();
server = serverIt->second; server = serverIt->second;
} }
RW(addr, send);
RW(port, send);
RW(sa, send);
ProxyMasterPacket::addServer(this, server, send); ProxyMasterPacket::addServer(this, server, send);
if (send) if (send)
serverIt++; serverIt++;
else else
servers->insert(pair<SystemAddress, QueryData>(sa, server)); servers->insert(pair<SystemAddress, QueryData>(SystemAddress(addr.c_str(), port), server));
} }
} }

@ -22,7 +22,14 @@ void PacketMasterUpdate::Packet(RakNet::BitStream *bs, bool send)
if (send) if (send)
bs->Write(packetID); bs->Write(packetID);
RW(server->first, send); string addr = server->first.ToString(false);
unsigned short port = server->first.GetPort();
RW(addr, send);
RW(port, send);
if(!send)
server->first = SystemAddress(addr.c_str(), port);
ProxyMasterPacket::addServer(this, server->second, send); ProxyMasterPacket::addServer(this, server->second, send);

Loading…
Cancel
Save