#include #include #include #include "WorldPacket.hpp" using namespace mwmp; void WorldPacket::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send) { BasePacket::Packet(bs, event->guid, send); this->event = event; } WorldPacket::WorldPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer) { packetID = 0; priority = HIGH_PRIORITY; reliability = RELIABLE_ORDERED; this->peer = peer; } WorldPacket::~WorldPacket() { } void WorldPacket::Send(BaseEvent *event, RakNet::AddressOrGUID destination) { bsSend->ResetWritePointer(); Packet(bsSend, event, true); peer->Send(bsSend, priority, reliability, 0, destination, false); } void WorldPacket::Send(BaseEvent *event, bool toOther) { bsSend->ResetWritePointer(); Packet(bsSend, event, true); peer->Send(bsSend, priority, reliability, 0, event->guid, toOther); } void WorldPacket::Read(BaseEvent *event) { Packet(bsRead, event, false); }