From 070c6a3bd43e5adf6d9dd5e8a0877fe850196b8b Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 9 Apr 2017 08:51:28 +0300 Subject: [PATCH] [General] Add ActorPacketController & make controller var names clearer --- apps/openmw-mp/ActorProcessor.cpp | 47 ++++++++ apps/openmw-mp/ActorProcessor.hpp | 32 +++++ apps/openmw-mp/CMakeLists.txt | 4 +- apps/openmw-mp/Cell.cpp | 24 ++++ apps/openmw-mp/Cell.hpp | 2 + apps/openmw-mp/Networking.cpp | 111 +++++++++++------- apps/openmw-mp/Networking.hpp | 13 +- apps/openmw-mp/PlayerProcessor.cpp | 2 +- apps/openmw-mp/ProcessorInitializer.cpp | 14 ++- apps/openmw-mp/Script/Functions/Cells.cpp | 4 +- apps/openmw-mp/Script/Functions/CharClass.cpp | 4 +- apps/openmw-mp/Script/Functions/Chat.cpp | 6 +- apps/openmw-mp/Script/Functions/GUI.cpp | 20 ++-- apps/openmw-mp/Script/Functions/Items.cpp | 10 +- apps/openmw-mp/Script/Functions/Positions.cpp | 4 +- apps/openmw-mp/Script/Functions/Quests.cpp | 4 +- apps/openmw-mp/Script/Functions/Spells.cpp | 4 +- apps/openmw-mp/Script/Functions/Stats.cpp | 36 +++--- apps/openmw-mp/Script/Functions/World.cpp | 48 ++++---- apps/openmw-mp/WorldProcessor.cpp | 2 +- .../ProcessorActorAuthority.hpp | 6 +- .../{world => actor}/ProcessorActorFrame.hpp | 6 +- .../{world => actor}/ProcessorActorList.hpp | 6 +- .../player/ProcessorPlayerAttack.hpp | 2 +- .../player/ProcessorPlayerCellChange.hpp | 2 +- .../player/ProcessorPlayerCellState.hpp | 2 +- apps/openmw/mwmp/Cell.cpp | 4 +- apps/openmw/mwmp/Networking.cpp | 58 +++++++-- apps/openmw/mwmp/Networking.hpp | 12 +- apps/openmw/mwmp/WorldEvent.cpp | 4 +- components/CMakeLists.txt | 8 +- .../Controllers/ActorPacketController.cpp | 45 +++++++ .../Controllers/ActorPacketController.hpp | 27 +++++ .../Controllers/WorldPacketController.cpp | 8 -- .../openmw-mp/Packets/Actor/ActorPacket.cpp | 25 ++++ .../openmw-mp/Packets/Actor/ActorPacket.hpp | 30 +++++ .../{World => Actor}/PacketActorAuthority.cpp | 4 +- .../{World => Actor}/PacketActorAuthority.hpp | 4 +- .../{World => Actor}/PacketActorFrame.cpp | 4 +- .../{World => Actor}/PacketActorFrame.hpp | 4 +- .../{World => Actor}/PacketActorList.cpp | 4 +- .../{World => Actor}/PacketActorList.hpp | 4 +- 42 files changed, 479 insertions(+), 181 deletions(-) create mode 100644 apps/openmw-mp/ActorProcessor.cpp create mode 100644 apps/openmw-mp/ActorProcessor.hpp rename apps/openmw-mp/processors/{world => actor}/ProcessorActorAuthority.hpp (67%) rename apps/openmw-mp/processors/{world => actor}/ProcessorActorFrame.hpp (79%) rename apps/openmw-mp/processors/{world => actor}/ProcessorActorList.hpp (82%) create mode 100644 components/openmw-mp/Controllers/ActorPacketController.cpp create mode 100644 components/openmw-mp/Controllers/ActorPacketController.hpp create mode 100644 components/openmw-mp/Packets/Actor/ActorPacket.cpp create mode 100644 components/openmw-mp/Packets/Actor/ActorPacket.hpp rename components/openmw-mp/Packets/{World => Actor}/PacketActorAuthority.cpp (94%) rename components/openmw-mp/Packets/{World => Actor}/PacketActorAuthority.hpp (72%) rename components/openmw-mp/Packets/{World => Actor}/PacketActorFrame.cpp (97%) rename components/openmw-mp/Packets/{World => Actor}/PacketActorFrame.hpp (71%) rename components/openmw-mp/Packets/{World => Actor}/PacketActorList.cpp (95%) rename components/openmw-mp/Packets/{World => Actor}/PacketActorList.hpp (71%) diff --git a/apps/openmw-mp/ActorProcessor.cpp b/apps/openmw-mp/ActorProcessor.cpp new file mode 100644 index 000000000..4f3c30657 --- /dev/null +++ b/apps/openmw-mp/ActorProcessor.cpp @@ -0,0 +1,47 @@ +#include "ActorProcessor.hpp" +#include "Networking.hpp" + +using namespace mwmp; + +ActorProcessor::processors_t ActorProcessor::processors; + +void ActorProcessor::Do(ActorPacket &packet, Player &player, BaseEvent &event) +{ + packet.Send(true); +} + +void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor) noexcept +{ + 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(), processor)); +} + +bool ActorProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept +{ + // Clear our BaseEvent before loading new data in it + event.cell.blank(); + event.objectChanges.objects.clear(); + event.guid = packet.guid; + for (auto &processor : processors) + { + if (processor.first == packet.data[0]) + { + Player *player = Players::getPlayer(packet.guid); + ActorPacket *myPacket = Networking::get().getActorPacketController()->GetPacket(packet.data[0]); + + myPacket->setEvent(&event); + + if (!processor.second->avoidReading) + myPacket->Read(); + + processor.second->Do(*myPacket, *player, event); + return true; + } + } + return false; +} diff --git a/apps/openmw-mp/ActorProcessor.hpp b/apps/openmw-mp/ActorProcessor.hpp new file mode 100644 index 000000000..00fda3ed2 --- /dev/null +++ b/apps/openmw-mp/ActorProcessor.hpp @@ -0,0 +1,32 @@ +#ifndef OPENMW_ACTORPROCESSOR_HPP +#define OPENMW_ACTORPROCESSOR_HPP + + +#include +#include +#include +#include +#include +#include +#include "Script/Script.hpp" +#include "Player.hpp" + +namespace mwmp +{ + class ActorProcessor : public BasePacketProcessor + { + public: + + virtual void Do(ActorPacket &packet, Player &player, BaseEvent &event); + + static bool Process(RakNet::Packet &packet, BaseEvent &event) noexcept; + static void AddProcessor(ActorProcessor *processor) noexcept; + + //typedef boost::unordered_map > processors_t; + typedef std::unordered_map > processors_t; + private: + static processors_t processors; + }; +} + +#endif //OPENMW_ACTORPROCESSOR_HPP diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index 2b85c288f..fac7d362f 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -79,9 +79,7 @@ set(SERVER Script/Functions/Spells.cpp Script/Functions/Timer.cpp Script/Functions/Positions.cpp Script/Functions/Cells.cpp Script/Functions/World.cpp Script/Functions/Miscellaneous.cpp - PlayerProcessor.cpp - WorldProcessor.cpp - ProcessorInitializer.cpp + ProcessorInitializer.cpp PlayerProcessor.cpp ActorProcessor.cpp WorldProcessor.cpp Script/API/TimerAPI.cpp Script/API/PublicFnAPI.cpp ${PawnScript_Sources} diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index 1dc7e5674..510e52773 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -51,6 +51,30 @@ Cell::TPlayers Cell::getPlayers() const return players; } +void Cell::sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseEvent *baseEvent) const +{ + if (players.empty()) + return; + + std::list plList; + + for (auto pl : players) + plList.push_back(pl); + + plList.sort(); + plList.unique(); + + for (auto pl : plList) + { + if (pl->guid == baseEvent->guid) continue; + + actorPacket->setEvent(baseEvent); + + // Send the packet to this eligible guid + actorPacket->Send(pl->guid); + } +} + void Cell::sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const { if (players.empty()) diff --git a/apps/openmw-mp/Cell.hpp b/apps/openmw-mp/Cell.hpp index 26eb26bc6..f0faca9bf 100644 --- a/apps/openmw-mp/Cell.hpp +++ b/apps/openmw-mp/Cell.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include class Player; @@ -62,6 +63,7 @@ public: void removePlayer(Player *player); TPlayers getPlayers() const; + void sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseEvent *baseEvent) const; void sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const; std::string getDescription() const; diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index 47109ca91..fae15ef8e 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -18,6 +18,7 @@ #include "MasterClient.hpp" #include "Cell.hpp" #include "PlayerProcessor.hpp" +#include "ActorProcessor.hpp" #include "WorldProcessor.hpp" #include #include @@ -37,12 +38,14 @@ Networking::Networking(RakNet::RakPeerInterface *peer) CellController::create(); - playerController = new PlayerPacketController(peer); - worldController = new WorldPacketController(peer); + playerPacketController = new PlayerPacketController(peer); + actorPacketController = new ActorPacketController(peer); + worldPacketController = new WorldPacketController(peer); // Set send stream - playerController->SetStream(0, &bsOut); - worldController->SetStream(0, &bsOut); + playerPacketController->SetStream(0, &bsOut); + actorPacketController->SetStream(0, &bsOut); + worldPacketController->SetStream(0, &bsOut); running = true; exitCode = 0; @@ -61,8 +64,8 @@ Networking::~Networking() CellController::destroy(); sThis = 0; - delete playerController; - delete worldController; + delete playerPacketController; + delete worldPacketController; LOG_QUIT(); } @@ -80,7 +83,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) { Player *player = Players::getPlayer(packet->guid); - PlayerPacket *myPacket = playerController->GetPacket(packet->data[0]); + PlayerPacket *myPacket = playerPacketController->GetPacket(packet->data[0]); if (packet->data[0] == ID_HANDSHAKE) { @@ -123,8 +126,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) if (!result) { - playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid)); - playerController->GetPacket(ID_USER_DISCONNECTED)->Send(false); + playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid)); + playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(false); Players::deletePlayer(packet->guid); return; } @@ -153,6 +156,18 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } +void Networking::processActorPacket(RakNet::Packet *packet) +{ + Player *player = Players::getPlayer(packet->guid); + + if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED) + return; + + if (!ActorProcessor::Process(*packet, baseEvent)) + LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled WorldPacket with identifier %i has arrived", packet->data[0]); + +} + void Networking::processWorldPacket(RakNet::Packet *packet) { Player *player = Players::getPlayer(packet->guid); @@ -193,24 +208,29 @@ void Networking::update(RakNet::Packet *packet) return; } - playerController->SetStream(&bsIn, 0); + playerPacketController->SetStream(&bsIn, 0); - playerController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid); + playerPacketController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid); Players::newPlayer(packet->guid); player = Players::getPlayer(packet->guid); - playerController->GetPacket(ID_USER_MYID)->setPlayer(player); - playerController->GetPacket(ID_USER_MYID)->Send(false); + playerPacketController->GetPacket(ID_USER_MYID)->setPlayer(player); + playerPacketController->GetPacket(ID_USER_MYID)->Send(false); return; } - else if (playerController->ContainsPacket(packet->data[0])) + else if (playerPacketController->ContainsPacket(packet->data[0])) { - playerController->SetStream(&bsIn, 0); + playerPacketController->SetStream(&bsIn, 0); processPlayerPacket(packet); } - else if (worldController->ContainsPacket(packet->data[0])) + else if (actorPacketController->ContainsPacket(packet->data[0])) + { + actorPacketController->SetStream(&bsIn, 0); + processActorPacket(packet); + } + else if (worldPacketController->ContainsPacket(packet->data[0])) { - worldController->SetStream(&bsIn, 0); + worldPacketController->SetStream(&bsIn, 0); processWorldPacket(packet); } else @@ -219,11 +239,11 @@ void Networking::update(RakNet::Packet *packet) void Networking::newPlayer(RakNet::RakNetGUID guid) { - playerController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid); - playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(guid); - playerController->GetPacket(ID_PLAYER_POS)->RequestData(guid); - playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(guid); - playerController->GetPacket(ID_PLAYER_EQUIPMENT)->RequestData(guid); + playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid); + playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(guid); + playerPacketController->GetPacket(ID_PLAYER_POS)->RequestData(guid); + playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(guid); + playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->RequestData(guid); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Sending info about other players to %lu", guid.g); @@ -241,21 +261,21 @@ void Networking::newPlayer(RakNet::RakNetGUID guid) // If we are iterating over a player who has inputted their name, proceed else if (pl->second->getLoadState() == Player::POSTLOADED) { - playerController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_POS)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second); - playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second); - - playerController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid); - playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(guid); - playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(guid); - playerController->GetPacket(ID_PLAYER_SKILL)->Send(guid); - playerController->GetPacket(ID_PLAYER_POS)->Send(guid); - playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(guid); - playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_POS)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second); + playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second); + + playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_SKILL)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_POS)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(guid); + playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(guid); } } @@ -270,19 +290,24 @@ void Networking::disconnectPlayer(RakNet::RakNetGUID guid) return; Script::Call(player->getId()); - playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player); - playerController->GetPacket(ID_USER_DISCONNECTED)->Send(true); + playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player); + playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(true); Players::deletePlayer(guid); } -PlayerPacketController *Networking::getPlayerController() const +PlayerPacketController *Networking::getPlayerPacketController() const +{ + return playerPacketController; +} + +ActorPacketController *Networking::getActorPacketController() const { - return playerController; + return actorPacketController; } -WorldPacketController *Networking::getWorldController() const +WorldPacketController *Networking::getWorldPacketController() const { - return worldController; + return worldPacketController; } BaseEvent *Networking::getLastEvent() diff --git a/apps/openmw-mp/Networking.hpp b/apps/openmw-mp/Networking.hpp index 5cfed17e7..cfe26dcd2 100644 --- a/apps/openmw-mp/Networking.hpp +++ b/apps/openmw-mp/Networking.hpp @@ -6,6 +6,7 @@ #define OPENMW_NETWORKING_HPP #include +#include #include #include "Player.hpp" @@ -23,6 +24,7 @@ namespace mwmp void kickPlayer(RakNet::RakNetGUID guid); void processPlayerPacket(RakNet::Packet *packet); + void processActorPacket(RakNet::Packet *packet); void processWorldPacket(RakNet::Packet *packet); void update(RakNet::Packet *packet); @@ -34,8 +36,10 @@ namespace mwmp void stopServer(int code); - PlayerPacketController *getPlayerController() const; - WorldPacketController *getWorldController() const; + PlayerPacketController *getPlayerPacketController() const; + ActorPacketController *getActorPacketController() const; + WorldPacketController *getWorldPacketController() const; + BaseEvent *getLastEvent(); int getCurrentMpNum(); @@ -59,8 +63,9 @@ namespace mwmp TPlayers *players; MasterClient *mclient; - PlayerPacketController *playerController; - WorldPacketController *worldController; + PlayerPacketController *playerPacketController; + ActorPacketController *actorPacketController; + WorldPacketController *worldPacketController; bool running; int exitCode; diff --git a/apps/openmw-mp/PlayerProcessor.cpp b/apps/openmw-mp/PlayerProcessor.cpp index b2247bd71..68656d055 100644 --- a/apps/openmw-mp/PlayerProcessor.cpp +++ b/apps/openmw-mp/PlayerProcessor.cpp @@ -29,7 +29,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) noexcept if (processor.first == packet.data[0]) { Player *player = Players::getPlayer(packet.guid); - PlayerPacket *myPacket = Networking::get().getPlayerController()->GetPacket(packet.data[0]); + PlayerPacket *myPacket = Networking::get().getPlayerPacketController()->GetPacket(packet.data[0]); myPacket->setPlayer(player); if (!processor.second->avoidReading) diff --git a/apps/openmw-mp/ProcessorInitializer.cpp b/apps/openmw-mp/ProcessorInitializer.cpp index ebf9fd18a..26d5d5e5d 100644 --- a/apps/openmw-mp/ProcessorInitializer.cpp +++ b/apps/openmw-mp/ProcessorInitializer.cpp @@ -24,10 +24,11 @@ #include "processors/player/ProcessorPlayerCharGen.hpp" #include "processors/player/ProcessorGUIMessageBox.hpp" #include "processors/player/ProcessorPlayerCharClass.hpp" +#include "ActorProcessor.hpp" +#include "processors/actor/ProcessorActorList.hpp" +#include "processors/actor/ProcessorActorAuthority.hpp" +#include "processors/actor/ProcessorActorFrame.hpp" #include "WorldProcessor.hpp" -#include "processors/world/ProcessorActorList.hpp" -#include "processors/world/ProcessorActorAuthority.hpp" -#include "processors/world/ProcessorActorFrame.hpp" #include "processors/world/ProcessorContainer.hpp" #include "processors/world/ProcessorDoorState.hpp" #include "processors/world/ProcessorMusicPlay.hpp" @@ -70,9 +71,10 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox()); PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass()); - WorldProcessor::AddProcessor(new ProcessorActorList()); - WorldProcessor::AddProcessor(new ProcessorActorAuthority()); - WorldProcessor::AddProcessor(new ProcessorActorFrame()); + ActorProcessor::AddProcessor(new ProcessorActorList()); + ActorProcessor::AddProcessor(new ProcessorActorAuthority()); + ActorProcessor::AddProcessor(new ProcessorActorFrame()); + WorldProcessor::AddProcessor(new ProcessorContainer()); WorldProcessor::AddProcessor(new ProcessorDoorState()); WorldProcessor::AddProcessor(new ProcessorMusicPlay()); diff --git a/apps/openmw-mp/Script/Functions/Cells.cpp b/apps/openmw-mp/Script/Functions/Cells.cpp index b138cdc09..aed41528f 100644 --- a/apps/openmw-mp/Script/Functions/Cells.cpp +++ b/apps/openmw-mp/Script/Functions/Cells.cpp @@ -110,6 +110,6 @@ void CellFunctions::SendCell(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(false); } diff --git a/apps/openmw-mp/Script/Functions/CharClass.cpp b/apps/openmw-mp/Script/Functions/CharClass.cpp index 3bc355735..d704693ce 100644 --- a/apps/openmw-mp/Script/Functions/CharClass.cpp +++ b/apps/openmw-mp/Script/Functions/CharClass.cpp @@ -15,8 +15,8 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARCLASS)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(false); } void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept diff --git a/apps/openmw-mp/Script/Functions/Chat.cpp b/apps/openmw-mp/Script/Functions/Chat.cpp index 3aed12060..ad3bad9c0 100644 --- a/apps/openmw-mp/Script/Functions/Chat.cpp +++ b/apps/openmw-mp/Script/Functions/Chat.cpp @@ -15,11 +15,11 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "System: %s", message); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(false); if (broadcast) - mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(true); } void ScriptFunctions::CleanChat(unsigned short pid) diff --git a/apps/openmw-mp/Script/Functions/GUI.cpp b/apps/openmw-mp/Script/Functions/GUI.cpp index 3c8151d16..58bbcd370 100644 --- a/apps/openmw-mp/Script/Functions/GUI.cpp +++ b/apps/openmw-mp/Script/Functions/GUI.cpp @@ -18,8 +18,8 @@ void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) no player->guiMessageBox.label = label; player->guiMessageBox.type = Player::GUIMessageBox::MessageBox; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); } void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept @@ -32,8 +32,8 @@ void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *labe player->guiMessageBox.buttons = buttons; player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); } void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept @@ -45,8 +45,8 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no player->guiMessageBox.label = label; player->guiMessageBox.type = Player::GUIMessageBox::InputDialog; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); } void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const char *items) @@ -59,8 +59,8 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const player->guiMessageBox.data = items; player->guiMessageBox.type = Player::GUIMessageBox::ListBox; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false); } void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept @@ -80,6 +80,6 @@ void GUIFunctions::SetConsoleAllow(unsigned short pid, bool state) player->consoleAllowed = state; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->Send(false); } diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index f5f1c144c..281b2bcb7 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -145,9 +145,9 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(true); } void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept @@ -156,8 +156,8 @@ void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->inventoryChanges, player->inventoryChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_INVENTORY)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_INVENTORY)->Send(false); player->inventoryChanges = std::move(player->inventoryChangesBuffer); player->inventoryChangesBuffer.items.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Positions.cpp b/apps/openmw-mp/Script/Functions/Positions.cpp index cfe3dc8ba..36e135acf 100644 --- a/apps/openmw-mp/Script/Functions/Positions.cpp +++ b/apps/openmw-mp/Script/Functions/Positions.cpp @@ -109,6 +109,6 @@ void PositionFunctions::SendPos(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_POS)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_POS)->Send(false); } diff --git a/apps/openmw-mp/Script/Functions/Quests.cpp b/apps/openmw-mp/Script/Functions/Quests.cpp index e5c873733..dcc3c0e84 100644 --- a/apps/openmw-mp/Script/Functions/Quests.cpp +++ b/apps/openmw-mp/Script/Functions/Quests.cpp @@ -73,8 +73,8 @@ void QuestFunctions::SendJournalChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->journalChanges, player->journalChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JOURNAL)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JOURNAL)->Send(false); player->journalChanges = std::move(player->journalChangesBuffer); player->journalChangesBuffer.journalItems.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index d474f7941..ae93cc95f 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -72,8 +72,8 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->spellbookChanges, player->spellbookChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPELLBOOK)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(false); player->spellbookChanges = std::move(player->spellbookChangesBuffer); player->spellbookChangesBuffer.spells.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index dd6845335..663cd9869 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -451,15 +451,15 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe player->charGenStage.current = start; player->charGenStage.end = end; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARGEN)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false); } void StatsFunctions::Resurrect(unsigned short pid) { Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_RESURRECT)->RequestData(player->guid); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->RequestData(player->guid); } void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept @@ -467,9 +467,9 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->Send(true); } void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept @@ -477,9 +477,9 @@ void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(true); } void StatsFunctions::SendAttributes(unsigned short pid) noexcept @@ -487,9 +487,9 @@ void StatsFunctions::SendAttributes(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(true); } void StatsFunctions::SendSkills(unsigned short pid) noexcept @@ -497,9 +497,9 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->Send(true); } void StatsFunctions::SendLevel(unsigned short pid) noexcept @@ -507,7 +507,7 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(true); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(true); } diff --git a/apps/openmw-mp/Script/Functions/World.cpp b/apps/openmw-mp/Script/Functions/World.cpp index 9235165c9..896be5b3d 100644 --- a/apps/openmw-mp/Script/Functions/World.cpp +++ b/apps/openmw-mp/Script/Functions/World.cpp @@ -273,56 +273,56 @@ void WorldFunctions::AddContainerItem() noexcept void WorldFunctions::SendActorList() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_LIST)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_LIST)->Send(scriptEvent.guid); + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->setEvent(&scriptEvent); + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->Send(scriptEvent.guid); } void WorldFunctions::SendActorAuthority() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_AUTHORITY)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptEvent.guid); + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->setEvent(&scriptEvent); + mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptEvent.guid); } void WorldFunctions::SendObjectDelete() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->Send(scriptEvent.guid); } void WorldFunctions::SendObjectPlace() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->Send(scriptEvent.guid); } void WorldFunctions::SendObjectScale() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->Send(scriptEvent.guid); } void WorldFunctions::SendObjectLock() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->Send(scriptEvent.guid); } void WorldFunctions::SendObjectUnlock() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->Send(scriptEvent.guid); } void WorldFunctions::SendDoorState() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->Send(scriptEvent.guid); } void WorldFunctions::SendContainer() noexcept { - mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->setEvent(&scriptEvent); - mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(scriptEvent.guid); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->setEvent(&scriptEvent); + mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->Send(scriptEvent.guid); } void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept @@ -334,8 +334,8 @@ void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept player->month = -1; player->day = -1; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); } void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept @@ -347,8 +347,8 @@ void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept player->month = month; player->day = -1; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); } @@ -361,6 +361,6 @@ void WorldFunctions::SetDay(unsigned short pid, int day) noexcept player->month = -1; player->day = day; - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); } diff --git a/apps/openmw-mp/WorldProcessor.cpp b/apps/openmw-mp/WorldProcessor.cpp index e98770aa2..94ab2a073 100644 --- a/apps/openmw-mp/WorldProcessor.cpp +++ b/apps/openmw-mp/WorldProcessor.cpp @@ -36,7 +36,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept if (processor.first == packet.data[0]) { Player *player = Players::getPlayer(packet.guid); - WorldPacket *myPacket = Networking::get().getWorldController()->GetPacket(packet.data[0]); + WorldPacket *myPacket = Networking::get().getWorldPacketController()->GetPacket(packet.data[0]); myPacket->setEvent(&event); diff --git a/apps/openmw-mp/processors/world/ProcessorActorAuthority.hpp b/apps/openmw-mp/processors/actor/ProcessorActorAuthority.hpp similarity index 67% rename from apps/openmw-mp/processors/world/ProcessorActorAuthority.hpp rename to apps/openmw-mp/processors/actor/ProcessorActorAuthority.hpp index 366faef9a..1d3845c70 100644 --- a/apps/openmw-mp/processors/world/ProcessorActorAuthority.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorAuthority.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PROCESSORACTORAUTHORITY_HPP #define OPENMW_PROCESSORACTORAUTHORITY_HPP -#include "apps/openmw-mp/WorldProcessor.hpp" +#include "apps/openmw-mp/ActorProcessor.hpp" namespace mwmp { - class ProcessorActorAuthority : public WorldProcessor + class ProcessorActorAuthority : public ActorProcessor { public: ProcessorActorAuthority() @@ -13,7 +13,7 @@ namespace mwmp BPP_INIT(ID_ACTOR_AUTHORITY) } - void Do(WorldPacket &packet, Player &player, BaseEvent &event) override + void Do(ActorPacket &packet, Player &player, BaseEvent &event) override { packet.Send(true); } diff --git a/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp b/apps/openmw-mp/processors/actor/ProcessorActorFrame.hpp similarity index 79% rename from apps/openmw-mp/processors/world/ProcessorActorFrame.hpp rename to apps/openmw-mp/processors/actor/ProcessorActorFrame.hpp index 38b693c7f..53a8bb29a 100644 --- a/apps/openmw-mp/processors/world/ProcessorActorFrame.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorFrame.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PROCESSORACTORFRAME_HPP #define OPENMW_PROCESSORACTORFRAME_HPP -#include "apps/openmw-mp/WorldProcessor.hpp" +#include "apps/openmw-mp/ActorProcessor.hpp" namespace mwmp { - class ProcessorActorFrame : public WorldProcessor + class ProcessorActorFrame : public ActorProcessor { public: ProcessorActorFrame() @@ -13,7 +13,7 @@ namespace mwmp BPP_INIT(ID_ACTOR_FRAME) } - void Do(WorldPacket &packet, Player &player, BaseEvent &event) override + void Do(ActorPacket &packet, Player &player, BaseEvent &event) override { // Send only to players who have the cell loaded Cell *serverCell = CellController::get()->getCell(&event.cell); diff --git a/apps/openmw-mp/processors/world/ProcessorActorList.hpp b/apps/openmw-mp/processors/actor/ProcessorActorList.hpp similarity index 82% rename from apps/openmw-mp/processors/world/ProcessorActorList.hpp rename to apps/openmw-mp/processors/actor/ProcessorActorList.hpp index bf8cbea02..bdada08a5 100644 --- a/apps/openmw-mp/processors/world/ProcessorActorList.hpp +++ b/apps/openmw-mp/processors/actor/ProcessorActorList.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PROCESSORACTORLIST_HPP #define OPENMW_PROCESSORACTORLIST_HPP -#include "apps/openmw-mp/WorldProcessor.hpp" +#include "apps/openmw-mp/ActorProcessor.hpp" namespace mwmp { - class ProcessorActorList : public WorldProcessor + class ProcessorActorList : public ActorProcessor { public: ProcessorActorList() @@ -13,7 +13,7 @@ namespace mwmp BPP_INIT(ID_ACTOR_LIST) } - void Do(WorldPacket &packet, Player &player, BaseEvent &event) override + void Do(ActorPacket &packet, Player &player, BaseEvent &event) override { LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerAttack.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerAttack.hpp index e4d26a72a..c074028c3 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerAttack.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerAttack.hpp @@ -17,7 +17,7 @@ namespace mwmp ProcessorPlayerAttack() { BPP_INIT(ID_PLAYER_ATTACK) - playerController = Networking::get().getPlayerController(); + playerController = Networking::get().getPlayerPacketController(); } void Do(PlayerPacket &packet, Player &player) override diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp index b2c058400..7a43ef4ed 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerCellChange.hpp @@ -19,7 +19,7 @@ namespace mwmp ProcessorPlayerCellChange() { BPP_INIT(ID_PLAYER_CELL_CHANGE) - playerController = Networking::get().getPlayerController(); + playerController = Networking::get().getPlayerPacketController(); } void Do(PlayerPacket &packet, Player &player) override diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerCellState.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerCellState.hpp index ff1339a1c..c91c86a45 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerCellState.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerCellState.hpp @@ -20,7 +20,7 @@ namespace mwmp ProcessorPlayerCellState() { BPP_INIT(ID_PLAYER_CELL_STATE) - playerController = Networking::get().getPlayerController(); + playerController = Networking::get().getPlayerPacketController(); } void Do(PlayerPacket &packet, Player &player) override diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index d64514412..53101fa9e 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -86,8 +86,8 @@ void Cell::updateLocal() } } - Main::get().getNetworking()->getWorldPacket(ID_ACTOR_FRAME)->setEvent(worldEvent); - Main::get().getNetworking()->getWorldPacket(ID_ACTOR_FRAME)->Send(); + Main::get().getNetworking()->getActorPacket(ID_ACTOR_FRAME)->setEvent(worldEvent); + Main::get().getNetworking()->getActorPacket(ID_ACTOR_FRAME)->Send(); } void Cell::updateDedicated(float dt) diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index b31a71711..a14f374c2 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -35,7 +35,8 @@ using namespace std; using namespace mwmp; -Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerController(peer), worldController(peer) +Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerPacketController(peer), + actorPacketController(peer), worldPacketController(peer) { RakNet::SocketDescriptor sd; @@ -43,8 +44,9 @@ Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerC RakNet::StartupResult b = peer->Startup(1,&sd, 1); RakAssert(b==RAKNET_STARTED); - playerController.SetStream(0, &bsOut); - worldController.SetStream(0, &bsOut); + playerPacketController.SetStream(0, &bsOut); + actorPacketController.SetStream(0, &bsOut); + worldPacketController.SetStream(0, &bsOut); connected = 0; } @@ -246,7 +248,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) if (guid != myGuid) pl = Players::getPlayer(guid); - PlayerPacket *myPacket = playerController.GetPacket(packet->data[0]); + PlayerPacket *myPacket = playerPacketController.GetPacket(packet->data[0]); switch (packet->data[0]) { @@ -575,8 +577,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) myPacket->Send(serverAddr); getLocalPlayer()->updateDynamicStats(true); - playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(getLocalPlayer()); - playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr); + playerPacketController.GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(getLocalPlayer()); + playerPacketController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr); } else if (pl != 0) { @@ -822,7 +824,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } } -void Networking::processWorldPacket(RakNet::Packet *packet) +void Networking::processActorPacket(RakNet::Packet *packet) { RakNet::RakNetGUID guid; RakNet::BitStream bsIn(&packet->data[1], packet->length, false); @@ -833,7 +835,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet) if (guid != myGuid) pl = Players::getPlayer(guid); - WorldPacket *myPacket = worldController.GetPacket(packet->data[0]); + ActorPacket *myPacket = actorPacketController.GetPacket(packet->data[0]); myPacket->setEvent(&worldEvent); myPacket->Packet(&bsIn, false); @@ -869,6 +871,29 @@ void Networking::processWorldPacket(RakNet::Packet *packet) break; } + default: + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled ActorPacket with identifier %i has arrived", packet->data[0]); + } +} + +void Networking::processWorldPacket(RakNet::Packet *packet) +{ + RakNet::RakNetGUID guid; + RakNet::BitStream bsIn(&packet->data[1], packet->length, false); + bsIn.Read(guid); + + DedicatedPlayer *pl = 0; + static RakNet::RakNetGUID myGuid = getLocalPlayer()->guid; + if (guid != myGuid) + pl = Players::getPlayer(guid); + + WorldPacket *myPacket = worldPacketController.GetPacket(packet->data[0]); + + myPacket->setEvent(&worldEvent); + myPacket->Packet(&bsIn, false); + + switch (packet->data[0]) + { case ID_CONTAINER: { MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell); @@ -1046,11 +1071,15 @@ void Networking::receiveMessage(RakNet::Packet *packet) if (packet->length < 2) return; - if (playerController.ContainsPacket(packet->data[0])) + if (playerPacketController.ContainsPacket(packet->data[0])) { processPlayerPacket(packet); } - else if (worldController.ContainsPacket(packet->data[0])) + else if (actorPacketController.ContainsPacket(packet->data[0])) + { + processActorPacket(packet); + } + else if (worldPacketController.ContainsPacket(packet->data[0])) { processWorldPacket(packet); } @@ -1058,12 +1087,17 @@ void Networking::receiveMessage(RakNet::Packet *packet) PlayerPacket *Networking::getPlayerPacket(RakNet::MessageID id) { - return playerController.GetPacket(id); + return playerPacketController.GetPacket(id); +} + +ActorPacket *Networking::getActorPacket(RakNet::MessageID id) +{ + return actorPacketController.GetPacket(id); } WorldPacket *Networking::getWorldPacket(RakNet::MessageID id) { - return worldController.GetPacket(id); + return worldPacketController.GetPacket(id); } LocalPlayer *Networking::getLocalPlayer() diff --git a/apps/openmw/mwmp/Networking.hpp b/apps/openmw/mwmp/Networking.hpp index abd0940b3..277228f4d 100644 --- a/apps/openmw/mwmp/Networking.hpp +++ b/apps/openmw/mwmp/Networking.hpp @@ -11,8 +11,11 @@ #include "WorldEvent.hpp" #include + #include +#include #include + #include namespace mwmp @@ -28,6 +31,7 @@ namespace mwmp void update(); PlayerPacket *getPlayerPacket(RakNet::MessageID id); + ActorPacket *getActorPacket(RakNet::MessageID id); WorldPacket *getWorldPacket(RakNet::MessageID id); bool isDedicatedPlayer(const MWWorld::Ptr &ptr); @@ -49,12 +53,16 @@ namespace mwmp RakNet::SystemAddress serverAddr; RakNet::BitStream bsOut; - PlayerPacketController playerController; - WorldPacketController worldController; + PlayerPacketController playerPacketController; + ActorPacketController actorPacketController; + WorldPacketController worldPacketController; + WorldEvent worldEvent; void processPlayerPacket(RakNet::Packet *packet); + void processActorPacket(RakNet::Packet *packet); void processWorldPacket(RakNet::Packet *packet); + void receiveMessage(RakNet::Packet *packet); void preInit(std::vector &content, Files::Collections &collections); diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index 34f609ccd..4388617c6 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -512,8 +512,8 @@ void WorldEvent::sendActors(MWWorld::CellStore* cellStore) addObject(worldObject); } - mwmp::Main::get().getNetworking()->getWorldPacket(ID_ACTOR_LIST)->setEvent(this); - mwmp::Main::get().getNetworking()->getWorldPacket(ID_ACTOR_LIST)->Send(); + mwmp::Main::get().getNetworking()->getActorPacket(ID_ACTOR_LIST)->setEvent(this); + mwmp::Main::get().getNetworking()->getActorPacket(ID_ACTOR_LIST)->Send(); } void WorldEvent::sendContainers(MWWorld::CellStore* cellStore) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 9105875ad..4c3913b05 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -149,8 +149,10 @@ add_component_dir (version add_component_dir (openmw-mp Log Utils - Controllers/PlayerPacketController Controllers/WorldPacketController - Packets/BasePacket Packets/Player/PlayerPacket Packets/World/WorldPacket + + Controllers/PlayerPacketController Controllers/ActorPacketController Controllers/WorldPacketController + + Packets/BasePacket Packets/Player/PlayerPacket Packets/Actor/ActorPacket Packets/World/WorldPacket Packets/Player/PacketHandshake Packets/Player/PacketChatMessage @@ -165,7 +167,7 @@ add_component_dir (openmw-mp Packets/Player/PacketGUIBoxes Packets/Player/PacketTime - Packets/World/PacketActorList Packets/World/PacketActorAuthority Packets/World/PacketActorFrame + Packets/Actor/PacketActorList Packets/Actor/PacketActorAuthority Packets/Actor/PacketActorFrame Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectMove diff --git a/components/openmw-mp/Controllers/ActorPacketController.cpp b/components/openmw-mp/Controllers/ActorPacketController.cpp new file mode 100644 index 000000000..b7033f10a --- /dev/null +++ b/components/openmw-mp/Controllers/ActorPacketController.cpp @@ -0,0 +1,45 @@ +#include +#include +#include + +#include "../Packets/Actor/PacketActorList.hpp" +#include "../Packets/Actor/PacketActorAuthority.hpp" +#include "../Packets/Actor/PacketActorFrame.hpp" + +#include "ActorPacketController.hpp" + +template +inline void AddPacket(mwmp::ActorPacketController::packets_t *packets, RakNet::RakPeerInterface *peer) +{ + T *packet = new T(peer); + typedef mwmp::ActorPacketController::packets_t::value_type value_t; + packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet))); +} + +mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *peer) +{ + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); +} + + +mwmp::ActorPacket *mwmp::ActorPacketController::GetPacket(RakNet::MessageID id) +{ + return packets[(unsigned char)id].get(); +} + +void mwmp::ActorPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream) +{ + BOOST_FOREACH( packets_t::value_type &packet, packets ) + packet.second->SetStreams(inStream, outStream); +} + +bool mwmp::ActorPacketController::ContainsPacket(RakNet::MessageID id) +{ + BOOST_FOREACH(packets_t::value_type &packet, packets) { + if (packet.first == id) + return true; + } + return false; +} diff --git a/components/openmw-mp/Controllers/ActorPacketController.hpp b/components/openmw-mp/Controllers/ActorPacketController.hpp new file mode 100644 index 000000000..249e81d5d --- /dev/null +++ b/components/openmw-mp/Controllers/ActorPacketController.hpp @@ -0,0 +1,27 @@ +#ifndef OPENMW_ACTORPACKETCONTROLLER_HPP +#define OPENMW_ACTORPACKETCONTROLLER_HPP + + +#include +#include "../Packets/Actor/ActorPacket.hpp" +#include +#include + +namespace mwmp +{ + class ActorPacketController + { + public: + ActorPacketController(RakNet::RakPeerInterface *peer); + ActorPacket *GetPacket(RakNet::MessageID id); + void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream); + + bool ContainsPacket(RakNet::MessageID id); + + typedef std::map > packets_t; + private: + packets_t packets; + }; +} + +#endif //OPENMW_WORLDPACKETCONTROLLER_HPP diff --git a/components/openmw-mp/Controllers/WorldPacketController.cpp b/components/openmw-mp/Controllers/WorldPacketController.cpp index 9ee8846c9..dece05a83 100644 --- a/components/openmw-mp/Controllers/WorldPacketController.cpp +++ b/components/openmw-mp/Controllers/WorldPacketController.cpp @@ -2,10 +2,6 @@ #include #include -#include "../Packets/World/PacketActorList.hpp" -#include "../Packets/World/PacketActorAuthority.hpp" -#include "../Packets/World/PacketActorFrame.hpp" - #include "../Packets/World/PacketObjectDelete.hpp" #include "../Packets/World/PacketObjectPlace.hpp" #include "../Packets/World/PacketObjectScale.hpp" @@ -37,10 +33,6 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer) { - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/Packets/Actor/ActorPacket.cpp b/components/openmw-mp/Packets/Actor/ActorPacket.cpp new file mode 100644 index 000000000..fcb42ea9b --- /dev/null +++ b/components/openmw-mp/Packets/Actor/ActorPacket.cpp @@ -0,0 +1,25 @@ +#include +#include +#include +#include "ActorPacket.hpp" + +using namespace mwmp; + +ActorPacket::ActorPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer) +{ + packetID = 0; + priority = HIGH_PRIORITY; + reliability = RELIABLE_ORDERED; + this->peer = peer; +} + +ActorPacket::~ActorPacket() +{ + +} + +void ActorPacket::setEvent(BaseEvent *event) +{ + this->event = event; + guid = event->guid; +} diff --git a/components/openmw-mp/Packets/Actor/ActorPacket.hpp b/components/openmw-mp/Packets/Actor/ActorPacket.hpp new file mode 100644 index 000000000..c52d723e2 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/ActorPacket.hpp @@ -0,0 +1,30 @@ +#ifndef OPENMW_ACTORPACKET_HPP +#define OPENMW_ACTORPACKET_HPP + +#include +#include +#include +#include +#include + +#include + + +namespace mwmp +{ + class ActorPacket : public BasePacket + { + public: + ActorPacket(RakNet::RakPeerInterface *peer); + + ~ActorPacket(); + + void setEvent(BaseEvent *event); + + protected: + BaseEvent *event; + + }; +} + +#endif //OPENMW_ACTORPACKET_HPP diff --git a/components/openmw-mp/Packets/World/PacketActorAuthority.cpp b/components/openmw-mp/Packets/Actor/PacketActorAuthority.cpp similarity index 94% rename from components/openmw-mp/Packets/World/PacketActorAuthority.cpp rename to components/openmw-mp/Packets/Actor/PacketActorAuthority.cpp index 65b33c96a..88f8f29e4 100644 --- a/components/openmw-mp/Packets/World/PacketActorAuthority.cpp +++ b/components/openmw-mp/Packets/Actor/PacketActorAuthority.cpp @@ -3,14 +3,14 @@ using namespace mwmp; -PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : ActorPacket(peer) { packetID = ID_ACTOR_AUTHORITY; } void PacketActorAuthority::Packet(RakNet::BitStream *bs, bool send) { - WorldPacket::Packet(bs, send); + ActorPacket::Packet(bs, send); if (!send) event->objectChanges.objects.clear(); diff --git a/components/openmw-mp/Packets/World/PacketActorAuthority.hpp b/components/openmw-mp/Packets/Actor/PacketActorAuthority.hpp similarity index 72% rename from components/openmw-mp/Packets/World/PacketActorAuthority.hpp rename to components/openmw-mp/Packets/Actor/PacketActorAuthority.hpp index f442d5ae2..3ddf52210 100644 --- a/components/openmw-mp/Packets/World/PacketActorAuthority.hpp +++ b/components/openmw-mp/Packets/Actor/PacketActorAuthority.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PACKETACTORAUTHORITY_HPP #define OPENMW_PACKETACTORAUTHORITY_HPP -#include +#include namespace mwmp { - class PacketActorAuthority : public WorldPacket + class PacketActorAuthority : public ActorPacket { public: PacketActorAuthority(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/World/PacketActorFrame.cpp b/components/openmw-mp/Packets/Actor/PacketActorFrame.cpp similarity index 97% rename from components/openmw-mp/Packets/World/PacketActorFrame.cpp rename to components/openmw-mp/Packets/Actor/PacketActorFrame.cpp index 221668d7f..d4158e91d 100644 --- a/components/openmw-mp/Packets/World/PacketActorFrame.cpp +++ b/components/openmw-mp/Packets/Actor/PacketActorFrame.cpp @@ -4,14 +4,14 @@ using namespace mwmp; -PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : ActorPacket(peer) { packetID = ID_ACTOR_FRAME; } void PacketActorFrame::Packet(RakNet::BitStream *bs, bool send) { - WorldPacket::Packet(bs, send); + ActorPacket::Packet(bs, send); if (!send) event->objectChanges.objects.clear(); diff --git a/components/openmw-mp/Packets/World/PacketActorFrame.hpp b/components/openmw-mp/Packets/Actor/PacketActorFrame.hpp similarity index 71% rename from components/openmw-mp/Packets/World/PacketActorFrame.hpp rename to components/openmw-mp/Packets/Actor/PacketActorFrame.hpp index 1961cccb9..942fd2cd8 100644 --- a/components/openmw-mp/Packets/World/PacketActorFrame.hpp +++ b/components/openmw-mp/Packets/Actor/PacketActorFrame.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PACKETACTORFRAME_HPP #define OPENMW_PACKETACTORFRAME_HPP -#include +#include namespace mwmp { - class PacketActorFrame : public WorldPacket + class PacketActorFrame : public ActorPacket { public: PacketActorFrame(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/World/PacketActorList.cpp b/components/openmw-mp/Packets/Actor/PacketActorList.cpp similarity index 95% rename from components/openmw-mp/Packets/World/PacketActorList.cpp rename to components/openmw-mp/Packets/Actor/PacketActorList.cpp index fcf512dbf..fad1eaabc 100644 --- a/components/openmw-mp/Packets/World/PacketActorList.cpp +++ b/components/openmw-mp/Packets/Actor/PacketActorList.cpp @@ -3,14 +3,14 @@ using namespace mwmp; -PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : ActorPacket(peer) { packetID = ID_ACTOR_LIST; } void PacketActorList::Packet(RakNet::BitStream *bs, bool send) { - WorldPacket::Packet(bs, send); + ActorPacket::Packet(bs, send); RW(event->action, send); diff --git a/components/openmw-mp/Packets/World/PacketActorList.hpp b/components/openmw-mp/Packets/Actor/PacketActorList.hpp similarity index 71% rename from components/openmw-mp/Packets/World/PacketActorList.hpp rename to components/openmw-mp/Packets/Actor/PacketActorList.hpp index 1435ef8dd..bea5abbdb 100644 --- a/components/openmw-mp/Packets/World/PacketActorList.hpp +++ b/components/openmw-mp/Packets/Actor/PacketActorList.hpp @@ -1,11 +1,11 @@ #ifndef OPENMW_PACKETACTORLIST_HPP #define OPENMW_PACKETACTORLIST_HPP -#include +#include namespace mwmp { - class PacketActorList : public WorldPacket + class PacketActorList : public ActorPacket { public: PacketActorList(RakNet::RakPeerInterface *peer);