From 61cc3ced5dfa3cc79ccdecc8bd5181c7fcdaff34 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 27 Jun 2017 15:25:30 +0800 Subject: [PATCH] [Client] Remove boost from processors --- apps/openmw/mwmp/processors/ActorProcessor.cpp | 7 +++---- apps/openmw/mwmp/processors/ActorProcessor.hpp | 6 ++---- apps/openmw/mwmp/processors/PlayerProcessor.cpp | 7 +++---- apps/openmw/mwmp/processors/PlayerProcessor.hpp | 7 ++----- apps/openmw/mwmp/processors/WorldProcessor.cpp | 9 +++------ apps/openmw/mwmp/processors/WorldProcessor.hpp | 6 ++---- 6 files changed, 15 insertions(+), 27 deletions(-) diff --git a/apps/openmw/mwmp/processors/ActorProcessor.cpp b/apps/openmw/mwmp/processors/ActorProcessor.cpp index 66498f501..3ac8d12fd 100644 --- a/apps/openmw/mwmp/processors/ActorProcessor.cpp +++ b/apps/openmw/mwmp/processors/ActorProcessor.cpp @@ -2,7 +2,6 @@ // Created by koncord on 18.04.17. // -#include #include "ActorProcessor.hpp" #include "../Networking.hpp" #include "../Main.hpp" @@ -21,7 +20,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList) myPacket->setActorList(&actorList); myPacket->SetReadStream(&bsIn); - BOOST_FOREACH(processors_t::value_type &processor, processors) + for(auto &processor : processors) { if (processor.first == packet.data[0]) { @@ -48,11 +47,11 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList) void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor) { - BOOST_FOREACH(processors_t::value_type &p, processors) + for(auto &p : processors) { if (processor->packetID == p.first) throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " + processor->className + " and " + p.second->className); } - processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr(processor))); + processors.insert(processors_t::value_type(processor->GetPacketID(), processor)); } diff --git a/apps/openmw/mwmp/processors/ActorProcessor.hpp b/apps/openmw/mwmp/processors/ActorProcessor.hpp index 9209c1914..bd4e4527e 100644 --- a/apps/openmw/mwmp/processors/ActorProcessor.hpp +++ b/apps/openmw/mwmp/processors/ActorProcessor.hpp @@ -5,12 +5,10 @@ #ifndef OPENMW_ACTORPROCESSOR_HPP #define OPENMW_ACTORPROCESSOR_HPP -#include -#include - #include #include #include +#include #include "../WorldEvent.hpp" #include "../ActorList.hpp" #include "BaseClientPacketProcessor.hpp" @@ -25,7 +23,7 @@ namespace mwmp static bool Process(RakNet::Packet &packet, ActorList &actorList); static void AddProcessor(ActorProcessor *processor); - typedef boost::unordered_map > processors_t; + typedef std::unordered_map > processors_t; private: static processors_t processors; diff --git a/apps/openmw/mwmp/processors/PlayerProcessor.cpp b/apps/openmw/mwmp/processors/PlayerProcessor.cpp index 796e2d77d..159d553e0 100644 --- a/apps/openmw/mwmp/processors/PlayerProcessor.cpp +++ b/apps/openmw/mwmp/processors/PlayerProcessor.cpp @@ -2,7 +2,6 @@ // Created by koncord on 04.04.17. // -#include #include "../Networking.hpp" #include "PlayerProcessor.hpp" #include "../Main.hpp" @@ -13,13 +12,13 @@ PlayerProcessor::processors_t PlayerProcessor::processors; void PlayerProcessor::AddProcessor(PlayerProcessor *processor) { - BOOST_FOREACH(processors_t::value_type &p, processors) + for(auto &p : processors) { if (processor->packetID == p.first) throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " + processor->className + " and " + p.second->className); } - processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr(processor))); + processors.insert(processors_t::value_type(processor->GetPacketID(), processor)); } bool PlayerProcessor::Process(RakNet::Packet &packet) @@ -35,7 +34,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) // error: packet not found }*/ - BOOST_FOREACH(processors_t::value_type &processor, processors) + for(auto &processor : processors) { if (processor.first == packet.data[0]) { diff --git a/apps/openmw/mwmp/processors/PlayerProcessor.hpp b/apps/openmw/mwmp/processors/PlayerProcessor.hpp index bc4661875..2ae9bf7ee 100644 --- a/apps/openmw/mwmp/processors/PlayerProcessor.hpp +++ b/apps/openmw/mwmp/processors/PlayerProcessor.hpp @@ -5,12 +5,10 @@ #ifndef OPENMW_PLAYERPROCESSOR_HPP #define OPENMW_PLAYERPROCESSOR_HPP -#include -#include - #include #include #include +#include #include "../LocalPlayer.hpp" #include "../DedicatedPlayer.hpp" #include "../PlayerList.hpp" @@ -26,8 +24,7 @@ namespace mwmp static bool Process(RakNet::Packet &packet); static void AddProcessor(PlayerProcessor *processor); - typedef boost::unordered_map > processors_t; - //typedef std::unordered_map > processors_t; + typedef std::unordered_map > processors_t; private: static processors_t processors; }; diff --git a/apps/openmw/mwmp/processors/WorldProcessor.cpp b/apps/openmw/mwmp/processors/WorldProcessor.cpp index 07f6e6783..974a04400 100644 --- a/apps/openmw/mwmp/processors/WorldProcessor.cpp +++ b/apps/openmw/mwmp/processors/WorldProcessor.cpp @@ -2,7 +2,6 @@ // Created by koncord on 16.04.17. // -#include #include "WorldProcessor.hpp" #include "../Main.hpp" #include "../Networking.hpp" @@ -21,7 +20,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event) myPacket->setEvent(&event); myPacket->SetReadStream(&bsIn); - BOOST_FOREACH(processors_t::value_type &processor, processors) + for(auto &processor: processors) { if (processor.first == packet.data[0]) { @@ -31,9 +30,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event) event.isValid = true; if (!request && !processor.second->avoidReading) - { myPacket->Read(); - } if (event.isValid) processor.second->Do(*myPacket, event); @@ -48,11 +45,11 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event) void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor) { - BOOST_FOREACH(processors_t::value_type &p, processors) + for(auto &p : processors) { if (processor->packetID == p.first) throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " + processor->className + " and " + p.second->className); } - processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr(processor))); + processors.insert(processors_t::value_type(processor->GetPacketID(), processor)); } diff --git a/apps/openmw/mwmp/processors/WorldProcessor.hpp b/apps/openmw/mwmp/processors/WorldProcessor.hpp index f12f4bf4d..7b8038afd 100644 --- a/apps/openmw/mwmp/processors/WorldProcessor.hpp +++ b/apps/openmw/mwmp/processors/WorldProcessor.hpp @@ -5,12 +5,10 @@ #ifndef OPENMW_WORLDPROCESSSOR_HPP #define OPENMW_WORLDPROCESSSOR_HPP -#include -#include - #include #include #include +#include #include "../WorldEvent.hpp" #include "../LocalPlayer.hpp" #include "../DedicatedPlayer.hpp" @@ -26,7 +24,7 @@ namespace mwmp static bool Process(RakNet::Packet &packet, WorldEvent &event); static void AddProcessor(WorldProcessor *processor); - typedef boost::unordered_map > processors_t; + typedef std::unordered_map > processors_t; private: static processors_t processors;