From 2b1b4ce2f1a00df72f2c0c3a1eb4a5aba72b9152 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 27 Jun 2017 22:41:37 +0800 Subject: [PATCH] [General] Update PacketControllers to C++11 --- .../openmw-mp/Controllers/ActorPacketController.cpp | 9 +++------ .../openmw-mp/Controllers/ActorPacketController.hpp | 6 +++--- .../openmw-mp/Controllers/PlayerPacketController.cpp | 9 +++------ .../openmw-mp/Controllers/PlayerPacketController.hpp | 6 +++--- .../openmw-mp/Controllers/WorldPacketController.cpp | 9 +++------ .../openmw-mp/Controllers/WorldPacketController.hpp | 6 +++--- 6 files changed, 18 insertions(+), 27 deletions(-) diff --git a/components/openmw-mp/Controllers/ActorPacketController.cpp b/components/openmw-mp/Controllers/ActorPacketController.cpp index c98d3a0bd..59aa9de01 100644 --- a/components/openmw-mp/Controllers/ActorPacketController.cpp +++ b/components/openmw-mp/Controllers/ActorPacketController.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #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; } diff --git a/components/openmw-mp/Controllers/ActorPacketController.hpp b/components/openmw-mp/Controllers/ActorPacketController.hpp index 47d7cf7a8..179c70d56 100644 --- a/components/openmw-mp/Controllers/ActorPacketController.hpp +++ b/components/openmw-mp/Controllers/ActorPacketController.hpp @@ -4,8 +4,8 @@ #include #include "../Packets/Actor/ActorPacket.hpp" -#include -#include +#include +#include namespace mwmp { @@ -18,7 +18,7 @@ namespace mwmp bool ContainsPacket(RakNet::MessageID id); - typedef std::map > packets_t; + typedef std::unordered_map > packets_t; private: packets_t packets; }; diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index c18604d9b..20487e55a 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #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; } diff --git a/components/openmw-mp/Controllers/PlayerPacketController.hpp b/components/openmw-mp/Controllers/PlayerPacketController.hpp index fc2927c65..4516bfe3d 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.hpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.hpp @@ -4,8 +4,8 @@ #include #include "../Packets/Player/PlayerPacket.hpp" -#include -#include +#include +#include namespace mwmp { @@ -18,7 +18,7 @@ namespace mwmp bool ContainsPacket(RakNet::MessageID id); - typedef std::map > packets_t; + typedef std::unordered_map > packets_t; private: packets_t packets; }; diff --git a/components/openmw-mp/Controllers/WorldPacketController.cpp b/components/openmw-mp/Controllers/WorldPacketController.cpp index e127c56b1..2e707fc30 100644 --- a/components/openmw-mp/Controllers/WorldPacketController.cpp +++ b/components/openmw-mp/Controllers/WorldPacketController.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #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; } diff --git a/components/openmw-mp/Controllers/WorldPacketController.hpp b/components/openmw-mp/Controllers/WorldPacketController.hpp index d96a8c886..a542a397b 100644 --- a/components/openmw-mp/Controllers/WorldPacketController.hpp +++ b/components/openmw-mp/Controllers/WorldPacketController.hpp @@ -4,8 +4,8 @@ #include #include "../Packets/World/WorldPacket.hpp" -#include -#include +#include +#include namespace mwmp { @@ -18,7 +18,7 @@ namespace mwmp bool ContainsPacket(RakNet::MessageID id); - typedef std::map > packets_t; + typedef std::unordered_map > packets_t; private: packets_t packets; };