// // Created by koncord on 15.01.16. // #include #include #include #include "Packets/PacketClass.hpp" #include "Packets/PacketPosition.hpp" #include "Packets/PacketBaseInfo.hpp" #include "components/openmw-mp/Packets/PacketEquiped.hpp" #include "Packets/PacketAttack.hpp" #include "Packets/PacketMainStats.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/PacketHandshake.hpp" #include "Packets/PacketGUIBoxes.hpp" #include "Packets/PacketTime.hpp" #include "PacketsController.hpp" template inline void AddPacket(mwmp::PacketsController::packets_t *packets, RakNet::RakPeerInterface *peer) { T *packet = new T(peer); typedef mwmp::PacketsController::packets_t::value_type value_t; packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet))); } mwmp::PacketsController::PacketsController(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); } mwmp::BasePacket *mwmp::PacketsController::GetPacket(RakNet::MessageID id) { return packets[(unsigned char)id].get(); } void mwmp::PacketsController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream) { BOOST_FOREACH( packets_t::value_type &packet, packets ) packet.second->SetStreams(inStream, outStream); }