Rename PacketsController into PlayerPacketController

coverity_scan^2
David Cernat 8 years ago
parent 5e0c0dd5f1
commit d2212ef80b

@ -26,7 +26,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
this->peer = peer;
players = Players::GetPlayers();
controller = new PacketsController(peer);
controller = new PlayerPacketController(peer);
controller->SetStream(0, &bsOut); // set send stream
@ -411,7 +411,7 @@ void Networking::DisconnectPlayer(RakNet::RakNetGUID guid)
Players::DeletePlayer(guid);
}
PacketsController *Networking::GetController() const
PlayerPacketController *Networking::GetController() const
{
return controller;
}

@ -5,7 +5,7 @@
#ifndef OPENMW_NETWORKING_HPP
#define OPENMW_NETWORKING_HPP
#include <components/openmw-mp/PacketsController.hpp>
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
#include "Player.hpp"
namespace mwmp
@ -27,7 +27,7 @@ namespace mwmp
void StopServer(int code);
PacketsController *GetController() const;
PlayerPacketController *GetController() const;
static const Networking &Get();
static Networking *GetPtr();
@ -37,7 +37,7 @@ namespace mwmp
RakNet::BitStream bsOut;
TPlayers *players;
PacketsController *controller;
PlayerPacketController *controller;
bool running;
int exitCode;

@ -19,7 +19,7 @@
#include <components/openmw-mp/Packets/PacketDie.hpp>
#include <components/openmw-mp/Packets/PacketCell.hpp>
#include <components/openmw-mp/Packets/PacketDrawState.hpp>
#include <components/openmw-mp/PacketsController.hpp>
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
namespace mwmp
{
@ -51,7 +51,7 @@ namespace mwmp
RakNet::SystemAddress serverAddr;
RakNet::BitStream bsOut;
PacketsController controller;
PlayerPacketController controller;
void ReceiveMessage(RakNet::Packet *packet);
LocalPlayer *getLocalPlayer();

@ -147,7 +147,7 @@ add_component_dir (version
add_component_dir (openmw-mp
Log
PacketsController
Controllers/PlayerPacketController
Packets/BasePacket Packets/PlayerPacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquipment
Packets/PacketAttack Packets/PacketDynamicStats Packets/PacketCell Packets/PacketDrawState Packets/PacketChatMessage
Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake

@ -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);

@ -1,22 +1,18 @@
//
// Created by koncord on 15.01.16.
//
#ifndef OPENMW_PACKETSCONTROLLER_HPP
#define OPENMW_PACKETSCONTROLLER_HPP
#ifndef OPENMW_PLAYERPACKETCONTROLLER_HPP
#define OPENMW_PLAYERPACKETCONTROLLER_HPP
#include <RakPeerInterface.h>
#include "Packets/PlayerPacket.hpp"
#include "../Packets/PlayerPacket.hpp"
#include <map>
#include <boost/shared_ptr.hpp>
namespace mwmp
{
class PacketsController
class PlayerPacketController
{
public:
PacketsController(RakNet::RakPeerInterface *peer);
PlayerPacketController(RakNet::RakPeerInterface *peer);
PlayerPacket *GetPacket(RakNet::MessageID id);
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
@ -26,4 +22,4 @@ namespace mwmp
};
}
#endif //OPENMW_PACKETSCONTROLLER_HPP
#endif //OPENMW_PLAYERPACKETCONTROLLER_HPP
Loading…
Cancel
Save