From 61da0d24755d315bcbf1a9aae883d975546fcfec Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 15 Jul 2018 00:36:07 +0300 Subject: [PATCH] [General] Turn PlayerInteraction into PlayerInput --- apps/openmw-mp/CMakeLists.txt | 2 +- apps/openmw-mp/Script/ScriptFunctions.hpp | 2 +- .../processors/ProcessorInitializer.cpp | 4 +-- .../player/ProcessorPlayerInput.hpp | 25 +++++++++++++++++++ .../player/ProcessorPlayerInteraction.hpp | 25 ------------------- apps/openmw/CMakeLists.txt | 2 +- .../mwmp/processors/ProcessorInitializer.cpp | 4 +-- ...teraction.hpp => ProcessorPlayerInput.hpp} | 12 ++++----- components/CMakeLists.txt | 2 +- .../Controllers/PlayerPacketController.cpp | 4 +-- components/openmw-mp/NetworkMessages.hpp | 2 +- .../Packets/Player/PacketPlayerInput.cpp | 16 ++++++++++++ .../Packets/Player/PacketPlayerInput.hpp | 17 +++++++++++++ .../Player/PacketPlayerInteraction.cpp | 16 ------------ .../Player/PacketPlayerInteraction.hpp | 17 ------------- 15 files changed, 75 insertions(+), 75 deletions(-) create mode 100644 apps/openmw-mp/processors/player/ProcessorPlayerInput.hpp delete mode 100644 apps/openmw-mp/processors/player/ProcessorPlayerInteraction.hpp rename apps/openmw/mwmp/processors/player/{ProcessorPlayerInteraction.hpp => ProcessorPlayerInput.hpp} (60%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerInput.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerInput.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketPlayerInteraction.cpp delete mode 100644 components/openmw-mp/Packets/Player/PacketPlayerInteraction.hpp diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index 84875de98..310694dac 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -105,7 +105,7 @@ set(PROCESSORS_PLAYER processors/player/ProcessorPlayerCellState.hpp processors/player/ProcessorPlayerCharClass.hpp processors/player/ProcessorPlayerCharGen.hpp processors/player/ProcessorPlayerDeath.hpp processors/player/ProcessorPlayerDisposition.hpp processors/player/ProcessorPlayerEquipment.hpp - processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInteraction.hpp + processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInput.hpp processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.hpp processors/player/ProcessorPlayerKillCount.hpp processors/player/ProcessorPlayerLevel.hpp processors/player/ProcessorPlayerMiscellaneous.hpp processors/player/ProcessorPlayerPosition.hpp diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index b32fd5201..c5e8abd8f 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -174,7 +174,7 @@ public: {"OnPlayerDisposition", Function()}, {"OnPlayerBook", Function()}, {"OnPlayerMiscellaneous", Function()}, - {"OnPlayerInteraction", Function()}, + {"OnPlayerInput", Function()}, {"OnPlayerRest", Function()}, {"OnRecordDynamic", Function()}, {"OnCellLoad", Function()}, diff --git a/apps/openmw-mp/processors/ProcessorInitializer.cpp b/apps/openmw-mp/processors/ProcessorInitializer.cpp index 9557a0c9b..97d7c0a24 100644 --- a/apps/openmw-mp/processors/ProcessorInitializer.cpp +++ b/apps/openmw-mp/processors/ProcessorInitializer.cpp @@ -24,7 +24,7 @@ #include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerJournal.hpp" #include "player/ProcessorPlayerKillCount.hpp" -#include "player/ProcessorPlayerInteraction.hpp" +#include "player/ProcessorPlayerInput.hpp" #include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp" #include "player/ProcessorPlayerPosition.hpp" @@ -101,7 +101,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount()); - PlayerProcessor::AddProcessor(new ProcessorPlayerInteraction()); + PlayerProcessor::AddProcessor(new ProcessorPlayerInput()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerInput.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerInput.hpp new file mode 100644 index 000000000..a638eac09 --- /dev/null +++ b/apps/openmw-mp/processors/player/ProcessorPlayerInput.hpp @@ -0,0 +1,25 @@ +#ifndef OPENMW_PROCESSORPLAYERINPUT_HPP +#define OPENMW_PROCESSORPLAYERINPUT_HPP + +#include "../PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerInput : public PlayerProcessor + { + public: + ProcessorPlayerInput() + { + BPP_INIT(ID_PLAYER_INPUT) + } + + void Do(PlayerPacket &packet, Player &player) override + { + DEBUG_PRINTF(strPacketID.c_str()); + + Script::Call(player.getId()); + } + }; +} + +#endif //OPENMW_PROCESSORPLAYERINPUT_HPP diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerInteraction.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerInteraction.hpp deleted file mode 100644 index ad6b186a9..000000000 --- a/apps/openmw-mp/processors/player/ProcessorPlayerInteraction.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef OPENMW_PROCESSORPLAYERINTERACTION_HPP -#define OPENMW_PROCESSORPLAYERINTERACTION_HPP - -#include "../PlayerProcessor.hpp" - -namespace mwmp -{ - class ProcessorPlayerInteraction : public PlayerProcessor - { - public: - ProcessorPlayerInteraction() - { - BPP_INIT(ID_PLAYER_INTERACTION) - } - - void Do(PlayerPacket &packet, Player &player) override - { - DEBUG_PRINTF(strPacketID.c_str()); - - Script::Call(player.getId()); - } - }; -} - -#endif //OPENMW_PROCESSORPLAYERINTERACTION_HPP diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index ce80ec15e..0d567c042 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -116,7 +116,7 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction - ProcessorPlayerInteraction ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount + ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index 2bd1da441..ee999c87b 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -23,7 +23,7 @@ #include "player/ProcessorPlayerDisposition.hpp" #include "player/ProcessorPlayerEquipment.hpp" #include "player/ProcessorPlayerFaction.hpp" -#include "player/ProcessorPlayerInteraction.hpp" +#include "player/ProcessorPlayerInput.hpp" #include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerJail.hpp" #include "player/ProcessorPlayerJournal.hpp" @@ -121,7 +121,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerDisposition()); PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); PlayerProcessor::AddProcessor(new ProcessorPlayerFaction()); - PlayerProcessor::AddProcessor(new ProcessorPlayerInteraction()); + PlayerProcessor::AddProcessor(new ProcessorPlayerInput()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerJail()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerInteraction.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerInput.hpp similarity index 60% rename from apps/openmw/mwmp/processors/player/ProcessorPlayerInteraction.hpp rename to apps/openmw/mwmp/processors/player/ProcessorPlayerInput.hpp index f0bd682c7..ca3a4c31a 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerInteraction.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerInput.hpp @@ -1,5 +1,5 @@ -#ifndef OPENMW_PROCESSORPLAYERINTERACTION_HPP -#define OPENMW_PROCESSORPLAYERINTERACTION_HPP +#ifndef OPENMW_PROCESSORPLAYERINPUT_HPP +#define OPENMW_PROCESSORPLAYERINPUT_HPP #include "apps/openmw/mwmp/Main.hpp" #include "../PlayerProcessor.hpp" @@ -7,12 +7,12 @@ namespace mwmp { - class ProcessorPlayerInteraction : public PlayerProcessor + class ProcessorPlayerInput : public PlayerProcessor { public: - ProcessorPlayerInteraction() + ProcessorPlayerInput() { - BPP_INIT(ID_PLAYER_INTERACTION) + BPP_INIT(ID_PLAYER_INPUT) } virtual void Do(PlayerPacket &packet, BasePlayer *player) @@ -24,4 +24,4 @@ namespace mwmp } -#endif //OPENMW_PROCESSORPLAYERINTERACTION_HPP +#endif //OPENMW_PROCESSORPLAYERINPUT_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index e761181fa..db599683b 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -181,7 +181,7 @@ add_component_dir (openmw-mp/Packets/Player PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerActiveSkills PacketPlayerAnimFlags PacketPlayerAnimPlay PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment - PacketPlayerFaction PacketPlayerInteraction PacketPlayerInventory PacketPlayerJail PacketPlayerJournal + PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerJail PacketPlayerJournal PacketPlayerKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index c104cc8de..2975c5706 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -21,7 +21,7 @@ #include "../Packets/Player/PacketPlayerDeath.hpp" #include "../Packets/Player/PacketPlayerEquipment.hpp" #include "../Packets/Player/PacketPlayerFaction.hpp" -#include "../Packets/Player/PacketPlayerInteraction.hpp" +#include "../Packets/Player/PacketPlayerInput.hpp" #include "../Packets/Player/PacketPlayerInventory.hpp" #include "../Packets/Player/PacketPlayerJail.hpp" #include "../Packets/Player/PacketPlayerJournal.hpp" @@ -78,7 +78,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p AddPacket(&packets, peer); AddPacket(&packets, 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/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 6af00212a..875a0f3c2 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -37,7 +37,7 @@ enum GameMessages ID_PLAYER_DISPOSITION, ID_PLAYER_EQUIPMENT, ID_PLAYER_FACTION, - ID_PLAYER_INTERACTION, + ID_PLAYER_INPUT, ID_PLAYER_INVENTORY, ID_PLAYER_JAIL, ID_PLAYER_JOURNAL, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInput.cpp b/components/openmw-mp/Packets/Player/PacketPlayerInput.cpp new file mode 100644 index 000000000..e088e531f --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerInput.cpp @@ -0,0 +1,16 @@ +#include "PacketPlayerInput.hpp" +#include + +using namespace mwmp; + +PacketPlayerInput::PacketPlayerInput(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_INPUT; +} + +void PacketPlayerInput::Packet(RakNet::BitStream *bs, bool send) +{ + PlayerPacket::Packet(bs, send); + + // Placeholder +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInput.hpp b/components/openmw-mp/Packets/Player/PacketPlayerInput.hpp new file mode 100644 index 000000000..fd2266fdc --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerInput.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETPLAYERINPUT_HPP +#define OPENMW_PACKETPLAYERINPUT_HPP + +#include + +namespace mwmp +{ + class PacketPlayerInput : public PlayerPacket + { + public: + PacketPlayerInput(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERINPUT_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInteraction.cpp b/components/openmw-mp/Packets/Player/PacketPlayerInteraction.cpp deleted file mode 100644 index fa2edc90f..000000000 --- a/components/openmw-mp/Packets/Player/PacketPlayerInteraction.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "PacketPlayerInteraction.hpp" -#include - -using namespace mwmp; - -PacketPlayerInteraction::PacketPlayerInteraction(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) -{ - packetID = ID_PLAYER_INTERACTION; -} - -void PacketPlayerInteraction::Packet(RakNet::BitStream *bs, bool send) -{ - PlayerPacket::Packet(bs, send); - - // Placeholder -} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInteraction.hpp b/components/openmw-mp/Packets/Player/PacketPlayerInteraction.hpp deleted file mode 100644 index 7bd6eabac..000000000 --- a/components/openmw-mp/Packets/Player/PacketPlayerInteraction.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OPENMW_PACKETPLAYERINTERACTION_HPP -#define OPENMW_PACKETPLAYERINTERACTION_HPP - -#include - -namespace mwmp -{ - class PacketPlayerInteraction : public PlayerPacket - { - public: - PacketPlayerInteraction(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, bool send); - }; -} - -#endif //OPENMW_PACKETPLAYERINTERACTION_HPP