You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/components/openmw-mp/Packets/BasePacket.cpp

46 lines
942 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include <PacketPriority.h>
#include <RakPeer.h>
#include "BasePacket.hpp"
using namespace mwmp;
BasePacket::BasePacket(RakNet::RakPeerInterface *peer)
{
packetID = 0;
priority = HIGH_PRIORITY;
reliability = RELIABLE_ORDERED;
this->peer = peer;
}
BasePacket::~BasePacket()
{
}
void BasePacket::SetReadStream(RakNet::BitStream *bitStream)
{
bsRead = bitStream;
}
void BasePacket::SetSendStream(RakNet::BitStream *bitStream)
{
bsSend = bitStream;
}
void BasePacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
{
if (inStream != 0)
bsRead = inStream;
if (outStream != 0)
bsSend = outStream;
}
void BasePacket::RequestData(RakNet::RakNetGUID guid)
{
bsSend->ResetWritePointer();
bsSend->Write(packetID);
bsSend->Write(guid);
peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false);
}