|
|
|
@ -1,44 +1,40 @@
|
|
|
|
|
//
|
|
|
|
|
// Created by koncord on 15.01.16.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
#include <boost/make_shared.hpp>
|
|
|
|
|
|
|
|
|
|
#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 "../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 "PacketsController.hpp"
|
|
|
|
|
#include "PlayerPacketController.hpp"
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
|
inline void AddPacket(mwmp::PacketsController::packets_t *packets, RakNet::RakPeerInterface *peer)
|
|
|
|
|
inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet::RakPeerInterface *peer)
|
|
|
|
|
{
|
|
|
|
|
T *packet = new T(peer);
|
|
|
|
|
typedef mwmp::PacketsController::packets_t::value_type value_t;
|
|
|
|
|
typedef mwmp::PlayerPacketController::packets_t::value_type value_t;
|
|
|
|
|
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
|
|
|
|
|
mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer)
|
|
|
|
|
{
|
|
|
|
|
AddPacket<PacketPosition>(&packets, peer);
|
|
|
|
|
AddPacket<PacketCell>(&packets, peer);
|
|
|
|
@ -68,12 +64,12 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mwmp::PlayerPacket *mwmp::PacketsController::GetPacket(RakNet::MessageID id)
|
|
|
|
|
mwmp::PlayerPacket *mwmp::PlayerPacketController::GetPacket(RakNet::MessageID id)
|
|
|
|
|
{
|
|
|
|
|
return packets[(unsigned char)id].get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mwmp::PacketsController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
|
|
|
|
void mwmp::PlayerPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
|
|
|
|
{
|
|
|
|
|
BOOST_FOREACH( packets_t::value_type &packet, packets )
|
|
|
|
|
packet.second->SetStreams(inStream, outStream);
|