From 1022b6b27c0bcf39c2902ec22875f53e3b92b66d Mon Sep 17 00:00:00 2001 From: Koncord Date: Sat, 6 Aug 2016 03:28:01 +0800 Subject: [PATCH] Fix a header size --- apps/openmw/mwmp/Networking.cpp | 2 +- components/openmw-mp/Packets/BasePacket.cpp | 4 ++-- components/openmw-mp/Packets/BasePacket.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 3c8149e1c..a91747753 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -161,7 +161,7 @@ void Networking::ReciveMessage(RakNet::Packet *packet) { RakNet::RakNetGUID id; - if(packet->length < 3) + if(packet->length < 2) return; RakNet::BitStream bsIn(&packet->data[1], packet->length, false); diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/BasePacket.cpp index b32680650..848bc80af 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/BasePacket.cpp @@ -16,7 +16,7 @@ void BasePacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) if(send) { - bs->Write((RakNet::MessageID) packetID); + bs->Write(packetID); bs->Write(player->guid); } } @@ -66,7 +66,7 @@ void BasePacket::SetSendStream(RakNet::BitStream *bitStream) void BasePacket::RequestData(RakNet::RakNetGUID player) { bsSend->ResetWritePointer(); - bsSend->Write((RakNet::MessageID) packetID); + bsSend->Write(packetID); bsSend->Write(player); peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, player, false); } diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp index 1cb10c855..fc5b371e3 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/BasePacket.hpp @@ -35,7 +35,7 @@ namespace mwmp size_t headerSize() { - return 10; // 10 == char + char + RakNetGUID (uint64_t) + return 9; // 9 == packetID + RakNetGUID (uint64_t) } protected: