From d2212ef80b9dbe645831b187c4ec56d469b03490 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 19 Oct 2016 16:31:07 +0300 Subject: [PATCH] Rename PacketsController into PlayerPacketController --- apps/openmw-mp/Networking.cpp | 4 +- apps/openmw-mp/Networking.hpp | 6 +- apps/openmw/mwmp/Networking.hpp | 4 +- components/CMakeLists.txt | 2 +- .../PlayerPacketController.cpp} | 58 +++++++++---------- .../PlayerPacketController.hpp} | 16 ++--- 6 files changed, 41 insertions(+), 49 deletions(-) rename components/openmw-mp/{PacketsController.cpp => Controllers/PlayerPacketController.cpp} (51%) rename components/openmw-mp/{PacketsController.hpp => Controllers/PlayerPacketController.hpp} (58%) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 67c63865f..4c6e9055a 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -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; } diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index 04399d69a..a19376485 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -5,7 +5,7 @@ #ifndef OPENMW_NETWORKING_HPP #define OPENMW_NETWORKING_HPP -#include +#include #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; diff --git a/apps/openmw/mwmp/Networking.hpp b/apps/openmw/mwmp/Networking.hpp index 430a6d849..bc2dd9c4c 100644 --- a/apps/openmw/mwmp/Networking.hpp +++ b/apps/openmw/mwmp/Networking.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include 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(); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index d0212861a..61fc1fda7 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -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 diff --git a/components/openmw-mp/PacketsController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp similarity index 51% rename from components/openmw-mp/PacketsController.cpp rename to components/openmw-mp/Controllers/PlayerPacketController.cpp index 19f82f938..1e283fe65 100644 --- a/components/openmw-mp/PacketsController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -1,44 +1,40 @@ -// -// Created by koncord on 15.01.16. -// - #include #include #include -#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 -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(&packets, peer); AddPacket(&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); diff --git a/components/openmw-mp/PacketsController.hpp b/components/openmw-mp/Controllers/PlayerPacketController.hpp similarity index 58% rename from components/openmw-mp/PacketsController.hpp rename to components/openmw-mp/Controllers/PlayerPacketController.hpp index f112743cf..efb104a07 100644 --- a/components/openmw-mp/PacketsController.hpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.hpp @@ -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 -#include "Packets/PlayerPacket.hpp" +#include "../Packets/PlayerPacket.hpp" #include #include 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