#include #include #include #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); }