From 6c8c0827ea151f44a7fe54e92159395ded1881b7 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 21 Nov 2016 01:31:07 +0200 Subject: [PATCH] Move RequestData() method to BasePacket --- components/openmw-mp/Packets/BasePacket.cpp | 10 +++++++++- components/openmw-mp/Packets/BasePacket.hpp | 2 +- components/openmw-mp/Packets/Player/PlayerPacket.cpp | 8 -------- components/openmw-mp/Packets/Player/PlayerPacket.hpp | 2 -- components/openmw-mp/Packets/World/WorldPacket.cpp | 8 -------- components/openmw-mp/Packets/World/WorldPacket.hpp | 2 -- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/BasePacket.cpp index 408b95c7e..4ccb2e71b 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/BasePacket.cpp @@ -34,4 +34,12 @@ void BasePacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outS bsRead = inStream; if (outStream != 0) bsSend = outStream; -} \ No newline at end of file +} + +void BasePacket::RequestData(RakNet::RakNetGUID guid) +{ + bsSend->ResetWritePointer(); + bsSend->Write(packetID); + bsSend->Write(guid); + peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false); +} diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp index 88b963734..a9d1dce3e 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/BasePacket.hpp @@ -20,6 +20,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); static size_t headerSize() { @@ -65,7 +66,6 @@ namespace mwmp } } - void RW(std::string &str, bool write) { if (write) diff --git a/components/openmw-mp/Packets/Player/PlayerPacket.cpp b/components/openmw-mp/Packets/Player/PlayerPacket.cpp index 338b7de27..32569f02a 100644 --- a/components/openmw-mp/Packets/Player/PlayerPacket.cpp +++ b/components/openmw-mp/Packets/Player/PlayerPacket.cpp @@ -48,11 +48,3 @@ void PlayerPacket::Read(BasePlayer *player) { Packet(bsRead, player, false); } - -void PlayerPacket::RequestData(RakNet::RakNetGUID guid) -{ - bsSend->ResetWritePointer(); - bsSend->Write(packetID); - bsSend->Write(guid); - peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false); -} diff --git a/components/openmw-mp/Packets/Player/PlayerPacket.hpp b/components/openmw-mp/Packets/Player/PlayerPacket.hpp index 8d4953183..da0105cce 100644 --- a/components/openmw-mp/Packets/Player/PlayerPacket.hpp +++ b/components/openmw-mp/Packets/Player/PlayerPacket.hpp @@ -25,8 +25,6 @@ namespace mwmp virtual void Send(BasePlayer *player, RakNet::AddressOrGUID destination); virtual void Read(BasePlayer *player); - virtual void RequestData(RakNet::RakNetGUID guid); - static size_t headerSize() { return (size_t)(1 + RakNet::RakNetGUID::size()); // packetID + RakNetGUID (uint64_t) diff --git a/components/openmw-mp/Packets/World/WorldPacket.cpp b/components/openmw-mp/Packets/World/WorldPacket.cpp index 543c6c5d6..8a962cac6 100644 --- a/components/openmw-mp/Packets/World/WorldPacket.cpp +++ b/components/openmw-mp/Packets/World/WorldPacket.cpp @@ -48,11 +48,3 @@ void WorldPacket::Read(WorldEvent *event) { Packet(bsRead, event, false); } - -void WorldPacket::RequestData(RakNet::RakNetGUID guid) -{ - bsSend->ResetWritePointer(); - bsSend->Write(packetID); - bsSend->Write(guid); - peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false); -} diff --git a/components/openmw-mp/Packets/World/WorldPacket.hpp b/components/openmw-mp/Packets/World/WorldPacket.hpp index 8ad187870..59950245e 100644 --- a/components/openmw-mp/Packets/World/WorldPacket.hpp +++ b/components/openmw-mp/Packets/World/WorldPacket.hpp @@ -25,8 +25,6 @@ namespace mwmp virtual void Send(WorldEvent *event, RakNet::AddressOrGUID destination); virtual void Read(WorldEvent *event); - virtual void RequestData(RakNet::RakNetGUID guid); - static size_t headerSize() { return (size_t)(1 + RakNet::RakNetGUID::size()); // packetID + RakNetGUID (uint64_t)