From 80bd268de601be426328b18de9c1d372c9fc9720 Mon Sep 17 00:00:00 2001 From: Koncord Date: Sat, 20 May 2017 16:46:59 +0800 Subject: [PATCH] [General] Use simple types for master server packets --- components/openmw-mp/Master/PacketMasterQuery.cpp | 11 +++++++---- components/openmw-mp/Master/PacketMasterUpdate.cpp | 9 ++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/openmw-mp/Master/PacketMasterQuery.cpp b/components/openmw-mp/Master/PacketMasterQuery.cpp index 04ae376fa..b31d94d97 100644 --- a/components/openmw-mp/Master/PacketMasterQuery.cpp +++ b/components/openmw-mp/Master/PacketMasterQuery.cpp @@ -34,22 +34,25 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send) serverIt = servers->begin(); QueryData server; - SystemAddress sa; + string addr; + unsigned short port; while(serversCount--) { if (send) { - sa = serverIt->first; + addr = serverIt->first.ToString(false); + port = serverIt->first.GetPort(); server = serverIt->second; } + RW(addr, send); + RW(port, send); - RW(sa, send); ProxyMasterPacket::addServer(this, server, send); if (send) serverIt++; else - servers->insert(pair(sa, server)); + servers->insert(pair(SystemAddress(addr.c_str(), port), server)); } } diff --git a/components/openmw-mp/Master/PacketMasterUpdate.cpp b/components/openmw-mp/Master/PacketMasterUpdate.cpp index 08ad0d1a2..c2e39d07e 100644 --- a/components/openmw-mp/Master/PacketMasterUpdate.cpp +++ b/components/openmw-mp/Master/PacketMasterUpdate.cpp @@ -22,7 +22,14 @@ void PacketMasterUpdate::Packet(RakNet::BitStream *bs, bool send) if (send) 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);