forked from teamnwah/openmw-tes3coop
[General] Update PacketControllers to C++11
This commit is contained in:
parent
0ed0d2417b
commit
2b1b4ce2f1
6 changed files with 18 additions and 27 deletions
|
@ -1,7 +1,3 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../Packets/Actor/PacketActorList.hpp"
|
||||
#include "../Packets/Actor/PacketActorAuthority.hpp"
|
||||
#include "../Packets/Actor/PacketActorTest.hpp"
|
||||
|
@ -52,13 +48,14 @@ mwmp::ActorPacket *mwmp::ActorPacketController::GetPacket(RakNet::MessageID id)
|
|||
|
||||
void mwmp::ActorPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
||||
{
|
||||
BOOST_FOREACH( packets_t::value_type &packet, packets )
|
||||
for(const auto &packet : packets)
|
||||
packet.second->SetStreams(inStream, outStream);
|
||||
}
|
||||
|
||||
bool mwmp::ActorPacketController::ContainsPacket(RakNet::MessageID id)
|
||||
{
|
||||
BOOST_FOREACH(packets_t::value_type &packet, packets) {
|
||||
for(const auto &packet : packets)
|
||||
{
|
||||
if (packet.first == id)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <RakPeerInterface.h>
|
||||
#include "../Packets/Actor/ActorPacket.hpp"
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace mwmp
|
|||
|
||||
bool ContainsPacket(RakNet::MessageID id);
|
||||
|
||||
typedef std::map<unsigned char, boost::shared_ptr<ActorPacket> > packets_t;
|
||||
typedef std::unordered_map<unsigned char, std::unique_ptr<ActorPacket> > packets_t;
|
||||
private:
|
||||
packets_t packets;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../Packets/Player/PacketDisconnect.hpp"
|
||||
#include "../Packets/Player/PacketChatMessage.hpp"
|
||||
#include "../Packets/Player/PacketPlayerCharGen.hpp"
|
||||
|
@ -100,13 +96,14 @@ mwmp::PlayerPacket *mwmp::PlayerPacketController::GetPacket(RakNet::MessageID id
|
|||
|
||||
void mwmp::PlayerPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
||||
{
|
||||
BOOST_FOREACH( packets_t::value_type &packet, packets )
|
||||
for(const auto &packet : packets)
|
||||
packet.second->SetStreams(inStream, outStream);
|
||||
}
|
||||
|
||||
bool mwmp::PlayerPacketController::ContainsPacket(RakNet::MessageID id)
|
||||
{
|
||||
BOOST_FOREACH(packets_t::value_type &packet, packets) {
|
||||
for(const auto &packet : packets)
|
||||
{
|
||||
if (packet.first == id)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <RakPeerInterface.h>
|
||||
#include "../Packets/Player/PlayerPacket.hpp"
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace mwmp
|
|||
|
||||
bool ContainsPacket(RakNet::MessageID id);
|
||||
|
||||
typedef std::map<unsigned char, boost::shared_ptr<PlayerPacket> > packets_t;
|
||||
typedef std::unordered_map<unsigned char, std::unique_ptr<PlayerPacket> > packets_t;
|
||||
private:
|
||||
packets_t packets;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../Packets/World/PacketObjectAnimPlay.hpp"
|
||||
#include "../Packets/World/PacketObjectDelete.hpp"
|
||||
#include "../Packets/World/PacketObjectLock.hpp"
|
||||
|
@ -63,13 +59,14 @@ mwmp::WorldPacket *mwmp::WorldPacketController::GetPacket(RakNet::MessageID id)
|
|||
|
||||
void mwmp::WorldPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
||||
{
|
||||
BOOST_FOREACH( packets_t::value_type &packet, packets )
|
||||
for(const auto &packet : packets)
|
||||
packet.second->SetStreams(inStream, outStream);
|
||||
}
|
||||
|
||||
bool mwmp::WorldPacketController::ContainsPacket(RakNet::MessageID id)
|
||||
{
|
||||
BOOST_FOREACH(packets_t::value_type &packet, packets) {
|
||||
for(const auto &packet : packets)
|
||||
{
|
||||
if (packet.first == id)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include <RakPeerInterface.h>
|
||||
#include "../Packets/World/WorldPacket.hpp"
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace mwmp
|
|||
|
||||
bool ContainsPacket(RakNet::MessageID id);
|
||||
|
||||
typedef std::map<unsigned char, boost::shared_ptr<WorldPacket> > packets_t;
|
||||
typedef std::unordered_map<unsigned char, std::unique_ptr<WorldPacket> > packets_t;
|
||||
private:
|
||||
packets_t packets;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue