#include #include #include #include "../Packets/PacketClass.hpp" #include "../Packets/PacketPosition.hpp" #include "../Packets/PacketBaseInfo.hpp" #include "../Packets/PacketEquipment.hpp" #include "../Packets/PacketAttack.hpp" #include "../Packets/PacketDynamicStats.hpp" #include "../Packets/PacketResurrect.hpp" #include "../Packets/PacketDie.hpp" #include "../Packets/PacketCell.hpp" #include "../Packets/PacketSendMyID.hpp" #include "../Packets/PacketDisconnect.hpp" #include "../Packets/PacketDrawState.hpp" #include "../Packets/PacketChatMessage.hpp" #include "../Packets/PacketCharGen.hpp" #include "../Packets/PacketAttribute.hpp" #include "../Packets/PacketSkill.hpp" #include "../Packets/PacketLevel.hpp" #include "../Packets/PacketHandshake.hpp" #include "../Packets/PacketGUIBoxes.hpp" #include "../Packets/PacketTime.hpp" #include "../Packets/PacketLoaded.hpp" #include "PlayerPacketController.hpp" template inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet::RakPeerInterface *peer) { T *packet = new T(peer); typedef mwmp::PlayerPacketController::packets_t::value_type value_t; packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet))); } mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) { AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); } mwmp::PlayerPacket *mwmp::PlayerPacketController::GetPacket(RakNet::MessageID id) { return packets[(unsigned char)id].get(); } void mwmp::PlayerPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream) { BOOST_FOREACH( packets_t::value_type &packet, packets ) packet.second->SetStreams(inStream, outStream); }