mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
[Client] Remove boost from processors
This commit is contained in:
parent
e68eee651a
commit
61cc3ced5d
6 changed files with 15 additions and 27 deletions
|
@ -2,7 +2,6 @@
|
||||||
// Created by koncord on 18.04.17.
|
// Created by koncord on 18.04.17.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "ActorProcessor.hpp"
|
#include "ActorProcessor.hpp"
|
||||||
#include "../Networking.hpp"
|
#include "../Networking.hpp"
|
||||||
#include "../Main.hpp"
|
#include "../Main.hpp"
|
||||||
|
@ -21,7 +20,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList)
|
||||||
myPacket->setActorList(&actorList);
|
myPacket->setActorList(&actorList);
|
||||||
myPacket->SetReadStream(&bsIn);
|
myPacket->SetReadStream(&bsIn);
|
||||||
|
|
||||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
for(auto &processor : processors)
|
||||||
{
|
{
|
||||||
if (processor.first == packet.data[0])
|
if (processor.first == packet.data[0])
|
||||||
{
|
{
|
||||||
|
@ -48,11 +47,11 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList)
|
||||||
|
|
||||||
void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor)
|
void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
for(auto &p : processors)
|
||||||
{
|
{
|
||||||
if (processor->packetID == p.first)
|
if (processor->packetID == p.first)
|
||||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||||
processor->className + " and " + p.second->className);
|
processor->className + " and " + p.second->className);
|
||||||
}
|
}
|
||||||
processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr<ActorProcessor>(processor)));
|
processors.insert(processors_t::value_type(processor->GetPacketID(), processor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
#ifndef OPENMW_ACTORPROCESSOR_HPP
|
#ifndef OPENMW_ACTORPROCESSOR_HPP
|
||||||
#define OPENMW_ACTORPROCESSOR_HPP
|
#define OPENMW_ACTORPROCESSOR_HPP
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||||
|
#include <unordered_map>
|
||||||
#include "../WorldEvent.hpp"
|
#include "../WorldEvent.hpp"
|
||||||
#include "../ActorList.hpp"
|
#include "../ActorList.hpp"
|
||||||
#include "BaseClientPacketProcessor.hpp"
|
#include "BaseClientPacketProcessor.hpp"
|
||||||
|
@ -25,7 +23,7 @@ namespace mwmp
|
||||||
static bool Process(RakNet::Packet &packet, ActorList &actorList);
|
static bool Process(RakNet::Packet &packet, ActorList &actorList);
|
||||||
static void AddProcessor(ActorProcessor *processor);
|
static void AddProcessor(ActorProcessor *processor);
|
||||||
|
|
||||||
typedef boost::unordered_map<unsigned char, std::shared_ptr<ActorProcessor> > processors_t;
|
typedef std::unordered_map<unsigned char, std::unique_ptr<ActorProcessor> > processors_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static processors_t processors;
|
static processors_t processors;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Created by koncord on 04.04.17.
|
// Created by koncord on 04.04.17.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "../Networking.hpp"
|
#include "../Networking.hpp"
|
||||||
#include "PlayerProcessor.hpp"
|
#include "PlayerProcessor.hpp"
|
||||||
#include "../Main.hpp"
|
#include "../Main.hpp"
|
||||||
|
@ -13,13 +12,13 @@ PlayerProcessor::processors_t PlayerProcessor::processors;
|
||||||
|
|
||||||
void PlayerProcessor::AddProcessor(PlayerProcessor *processor)
|
void PlayerProcessor::AddProcessor(PlayerProcessor *processor)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
for(auto &p : processors)
|
||||||
{
|
{
|
||||||
if (processor->packetID == p.first)
|
if (processor->packetID == p.first)
|
||||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||||
processor->className + " and " + p.second->className);
|
processor->className + " and " + p.second->className);
|
||||||
}
|
}
|
||||||
processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr<PlayerProcessor>(processor)));
|
processors.insert(processors_t::value_type(processor->GetPacketID(), processor));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerProcessor::Process(RakNet::Packet &packet)
|
bool PlayerProcessor::Process(RakNet::Packet &packet)
|
||||||
|
@ -35,7 +34,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet)
|
||||||
// error: packet not found
|
// error: packet not found
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
for(auto &processor : processors)
|
||||||
{
|
{
|
||||||
if (processor.first == packet.data[0])
|
if (processor.first == packet.data[0])
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
#ifndef OPENMW_PLAYERPROCESSOR_HPP
|
#ifndef OPENMW_PLAYERPROCESSOR_HPP
|
||||||
#define OPENMW_PLAYERPROCESSOR_HPP
|
#define OPENMW_PLAYERPROCESSOR_HPP
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||||
|
#include <unordered_map>
|
||||||
#include "../LocalPlayer.hpp"
|
#include "../LocalPlayer.hpp"
|
||||||
#include "../DedicatedPlayer.hpp"
|
#include "../DedicatedPlayer.hpp"
|
||||||
#include "../PlayerList.hpp"
|
#include "../PlayerList.hpp"
|
||||||
|
@ -26,8 +24,7 @@ namespace mwmp
|
||||||
static bool Process(RakNet::Packet &packet);
|
static bool Process(RakNet::Packet &packet);
|
||||||
static void AddProcessor(PlayerProcessor *processor);
|
static void AddProcessor(PlayerProcessor *processor);
|
||||||
|
|
||||||
typedef boost::unordered_map<unsigned char, std::shared_ptr<PlayerProcessor> > processors_t;
|
typedef std::unordered_map<unsigned char, std::unique_ptr<PlayerProcessor> > processors_t;
|
||||||
//typedef std::unordered_map<unsigned char, std::unique_ptr<PlayerProcessor> > processors_t;
|
|
||||||
private:
|
private:
|
||||||
static processors_t processors;
|
static processors_t processors;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// Created by koncord on 16.04.17.
|
// Created by koncord on 16.04.17.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include "WorldProcessor.hpp"
|
#include "WorldProcessor.hpp"
|
||||||
#include "../Main.hpp"
|
#include "../Main.hpp"
|
||||||
#include "../Networking.hpp"
|
#include "../Networking.hpp"
|
||||||
|
@ -21,7 +20,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
|
||||||
myPacket->setEvent(&event);
|
myPacket->setEvent(&event);
|
||||||
myPacket->SetReadStream(&bsIn);
|
myPacket->SetReadStream(&bsIn);
|
||||||
|
|
||||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
for(auto &processor: processors)
|
||||||
{
|
{
|
||||||
if (processor.first == packet.data[0])
|
if (processor.first == packet.data[0])
|
||||||
{
|
{
|
||||||
|
@ -31,9 +30,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
|
||||||
event.isValid = true;
|
event.isValid = true;
|
||||||
|
|
||||||
if (!request && !processor.second->avoidReading)
|
if (!request && !processor.second->avoidReading)
|
||||||
{
|
|
||||||
myPacket->Read();
|
myPacket->Read();
|
||||||
}
|
|
||||||
|
|
||||||
if (event.isValid)
|
if (event.isValid)
|
||||||
processor.second->Do(*myPacket, event);
|
processor.second->Do(*myPacket, event);
|
||||||
|
@ -48,11 +45,11 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
|
||||||
|
|
||||||
void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor)
|
void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
for(auto &p : processors)
|
||||||
{
|
{
|
||||||
if (processor->packetID == p.first)
|
if (processor->packetID == p.first)
|
||||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||||
processor->className + " and " + p.second->className);
|
processor->className + " and " + p.second->className);
|
||||||
}
|
}
|
||||||
processors.insert(processors_t::value_type(processor->GetPacketID(), std::shared_ptr<WorldProcessor>(processor)));
|
processors.insert(processors_t::value_type(processor->GetPacketID(), processor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
#ifndef OPENMW_WORLDPROCESSSOR_HPP
|
#ifndef OPENMW_WORLDPROCESSSOR_HPP
|
||||||
#define OPENMW_WORLDPROCESSSOR_HPP
|
#define OPENMW_WORLDPROCESSSOR_HPP
|
||||||
|
|
||||||
#include <boost/unordered_map.hpp>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||||
|
#include <unordered_map>
|
||||||
#include "../WorldEvent.hpp"
|
#include "../WorldEvent.hpp"
|
||||||
#include "../LocalPlayer.hpp"
|
#include "../LocalPlayer.hpp"
|
||||||
#include "../DedicatedPlayer.hpp"
|
#include "../DedicatedPlayer.hpp"
|
||||||
|
@ -26,7 +24,7 @@ namespace mwmp
|
||||||
static bool Process(RakNet::Packet &packet, WorldEvent &event);
|
static bool Process(RakNet::Packet &packet, WorldEvent &event);
|
||||||
static void AddProcessor(WorldProcessor *processor);
|
static void AddProcessor(WorldProcessor *processor);
|
||||||
|
|
||||||
typedef boost::unordered_map<unsigned char, std::shared_ptr<WorldProcessor> > processors_t;
|
typedef std::unordered_map<unsigned char, std::unique_ptr<WorldProcessor> > processors_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static processors_t processors;
|
static processors_t processors;
|
||||||
|
|
Loading…
Reference in a new issue