From 8384a8aa8a816f9cc31a8178331580f79bc040f3 Mon Sep 17 00:00:00 2001 From: Koncord Date: Mon, 31 Jul 2017 18:57:57 +0800 Subject: [PATCH] [General] Return sent packet number --- components/openmw-mp/Packets/BasePacket.cpp | 12 ++++++------ components/openmw-mp/Packets/BasePacket.hpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/BasePacket.cpp index 2cffec9d0..65b7f5f3c 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/BasePacket.cpp @@ -48,26 +48,26 @@ void BasePacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outS bsSend = outStream; } -void BasePacket::RequestData(RakNet::RakNetGUID guid) +uint32_t BasePacket::RequestData(RakNet::RakNetGUID guid) { bsSend->ResetWritePointer(); bsSend->Write(packetID); bsSend->Write(guid); - peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, orderChannel, guid, false); + return peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, orderChannel, guid, false); } -void BasePacket::Send(RakNet::AddressOrGUID destination) +uint32_t BasePacket::Send(RakNet::AddressOrGUID destination) { bsSend->ResetWritePointer(); Packet(bsSend, true); - peer->Send(bsSend, priority, reliability, orderChannel, destination, false); + return peer->Send(bsSend, priority, reliability, orderChannel, destination, false); } -void BasePacket::Send(bool toOther) +uint32_t BasePacket::Send(bool toOther) { bsSend->ResetWritePointer(); Packet(bsSend, true); - peer->Send(bsSend, priority, reliability, orderChannel, guid, toOther); + return peer->Send(bsSend, priority, reliability, orderChannel, guid, toOther); } void BasePacket::Read() diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp index e298d27b7..b51ce0695 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/BasePacket.hpp @@ -17,8 +17,8 @@ namespace mwmp virtual ~BasePacket(); virtual void Packet(RakNet::BitStream *bs, bool send); - virtual void Send(bool toOtherPlayers = true); - virtual void Send(RakNet::AddressOrGUID destination); + virtual uint32_t Send(bool toOtherPlayers = true); + virtual uint32_t Send(RakNet::AddressOrGUID destination); virtual void Read(); void setGUID(RakNet::RakNetGUID guid); @@ -27,7 +27,7 @@ namespace mwmp void SetReadStream(RakNet::BitStream *bitStream); void SetSendStream(RakNet::BitStream *bitStream); void SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outStream); - virtual void RequestData(RakNet::RakNetGUID guid); + virtual uint32_t RequestData(RakNet::RakNetGUID guid); static size_t headerSize() {