diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 291b75973..c3ede8522 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -135,7 +135,8 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor ) add_openmw_dir (mwmp/processors/worldstate ProcessorCellCreate ProcessorCellReplace ProcessorRecordDynamic - ProcessorWorldCollisionOverride ProcessorWorldMap ProcessorWorldTime ProcessorWorldWeather + ProcessorWorldCollisionOverride ProcessorWorldMap ProcessorWorldRegionAuthority ProcessorWorldTime + ProcessorWorldWeather ) # Main executable diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index 3d98ae917..56b2d49b6 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -32,7 +32,6 @@ #include "player/ProcessorPlayerMomentum.hpp" #include "player/ProcessorPlayerPosition.hpp" #include "player/ProcessorPlayerQuickKeys.hpp" -#include "player/ProcessorPlayerRegionAuthority.hpp" #include "player/ProcessorPlayerReputation.hpp" #include "player/ProcessorPlayerRest.hpp" #include "player/ProcessorPlayerResurrect.hpp" @@ -93,6 +92,7 @@ #include "worldstate/ProcessorRecordDynamic.hpp" #include "worldstate/ProcessorWorldCollisionOverride.hpp" #include "worldstate/ProcessorWorldMap.hpp" +#include "worldstate/ProcessorWorldRegionAuthority.hpp" #include "worldstate/ProcessorWorldTime.hpp" #include "worldstate/ProcessorWorldWeather.hpp" @@ -131,7 +131,6 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum()); PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); PlayerProcessor::AddProcessor(new ProcessorPlayerQuickKeys()); - PlayerProcessor::AddProcessor(new ProcessorPlayerRegionAuthority()); PlayerProcessor::AddProcessor(new ProcessorPlayerReputation()); PlayerProcessor::AddProcessor(new ProcessorPlayerRest()); PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect()); @@ -189,6 +188,7 @@ void ProcessorInitializer() WorldstateProcessor::AddProcessor(new ProcessorRecordDynamic()); WorldstateProcessor::AddProcessor(new ProcessorWorldCollisionOverride()); WorldstateProcessor::AddProcessor(new ProcessorWorldMap()); + WorldstateProcessor::AddProcessor(new ProcessorWorldRegionAuthority()); WorldstateProcessor::AddProcessor(new ProcessorWorldTime()); WorldstateProcessor::AddProcessor(new ProcessorWorldWeather()); } diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerRegionAuthority.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerRegionAuthority.hpp deleted file mode 100644 index 8df1777cb..000000000 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerRegionAuthority.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef OPENMW_PROCESSORPLAYERREGIONAUTHORITY_HPP -#define OPENMW_PROCESSORPLAYERREGIONAUTHORITY_HPP - -#include "../PlayerProcessor.hpp" - -namespace mwmp -{ - class ProcessorPlayerRegionAuthority : public PlayerProcessor - { - public: - ProcessorPlayerRegionAuthority() - { - BPP_INIT(ID_PLAYER_REGION_AUTHORITY) - } - - virtual void Do(PlayerPacket &packet, BasePlayer *player) - { - // Placeholder to be filled in later - } - }; -} - -#endif //OPENMW_PROCESSORPLAYERREGIONAUTHORITY_HPP diff --git a/apps/openmw/mwmp/processors/worldstate/ProcessorWorldRegionAuthority.hpp b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldRegionAuthority.hpp new file mode 100644 index 000000000..f36b3ee20 --- /dev/null +++ b/apps/openmw/mwmp/processors/worldstate/ProcessorWorldRegionAuthority.hpp @@ -0,0 +1,31 @@ +#ifndef OPENMW_PROCESSORWORLDREGIONAUTHORITY_HPP +#define OPENMW_PROCESSORWORLDREGIONAUTHORITY_HPP + +#include "../PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorWorldRegionAuthority : public WorldstateProcessor + { + public: + ProcessorWorldRegionAuthority() + { + BPP_INIT(ID_WORLD_REGION_AUTHORITY) + } + + virtual void Do(WorldstatePacket &packet, Worldstate &worldstate) + { + if (isLocal()) + { + LOG_APPEND(Log::LOG_INFO, "- The new region authority for %s is me"); + + } + else + { + + } + } + }; +} + +#endif //OPENMW_PROCESSORWORLDREGIONAUTHORITY_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 05a2d73cb..cf9d43ae1 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -183,9 +183,8 @@ add_component_dir (openmw-mp/Packets/Player PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerJail PacketPlayerJournal PacketWorldKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition - PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect - PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic - PacketPlayerTopic + PacketPlayerQuickKeys PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect PacketPlayerShapeshift + PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic ) add_component_dir (openmw-mp/Packets/Object @@ -203,7 +202,7 @@ add_component_dir (openmw-mp/Packets/Worldstate WorldstatePacket PacketCellCreate PacketCellReplace PacketRecordDynamic PacketWorldCollisionOverride PacketWorldMap - PacketWorldTime PacketWorldWeather + PacketWorldRegionAuthority PacketWorldTime PacketWorldWeather ) add_component_dir (fallback diff --git a/components/openmw-mp/Base/BaseWorldstate.hpp b/components/openmw-mp/Base/BaseWorldstate.hpp index 96506b33d..9c31e67d6 100644 --- a/components/openmw-mp/Base/BaseWorldstate.hpp +++ b/components/openmw-mp/Base/BaseWorldstate.hpp @@ -47,6 +47,8 @@ namespace mwmp bool hasPlacedObjectCollision; bool useActorCollisionForPlacedObjects; + std::string authorityRegion; + std::vector enforcedCollisionRefIds; std::vector mapTiles; diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 005a39d57..085779ef9 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -30,7 +30,6 @@ #include "../Packets/Player/PacketPlayerMomentum.hpp" #include "../Packets/Player/PacketPlayerPosition.hpp" #include "../Packets/Player/PacketPlayerQuickKeys.hpp" -#include "../Packets/Player/PacketPlayerRegionAuthority.hpp" #include "../Packets/Player/PacketPlayerReputation.hpp" #include "../Packets/Player/PacketPlayerRest.hpp" #include "../Packets/Player/PacketPlayerResurrect.hpp" @@ -86,7 +85,6 @@ 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); diff --git a/components/openmw-mp/Controllers/WorldstatePacketController.cpp b/components/openmw-mp/Controllers/WorldstatePacketController.cpp index 1320745a3..49babf338 100644 --- a/components/openmw-mp/Controllers/WorldstatePacketController.cpp +++ b/components/openmw-mp/Controllers/WorldstatePacketController.cpp @@ -3,6 +3,7 @@ #include "../Packets/Worldstate/PacketRecordDynamic.hpp" #include "../Packets/Worldstate/PacketWorldCollisionOverride.hpp" #include "../Packets/Worldstate/PacketWorldMap.hpp" +#include "../Packets/Worldstate/PacketWorldRegionAuthority.hpp" #include "../Packets/Worldstate/PacketWorldTime.hpp" #include "../Packets/Worldstate/PacketWorldWeather.hpp" @@ -23,6 +24,7 @@ mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInte 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 44e02274a..5c0f655bd 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -45,7 +45,7 @@ enum GameMessages ID_PLAYER_MOMENTUM, ID_PLAYER_POSITION, ID_PLAYER_QUICKKEYS, - ID_PLAYER_REGION_AUTHORITY, + ID_WORLD_REGION_AUTHORITY, ID_PLAYER_REPUTATION, ID_PLAYER_RESURRECT, ID_PLAYER_REST, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.cpp b/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.cpp index 3a8748aef..1f7bd0ce4 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.cpp @@ -1,16 +1,16 @@ #include -#include "PacketPlayerRegionAuthority.hpp" +#include "PacketWorldRegionAuthority.hpp" -mwmp::PacketPlayerRegionAuthority::PacketPlayerRegionAuthority(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +mwmp::PacketWorldRegionAuthority::PacketWorldRegionAuthority(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_PLAYER_REGION_AUTHORITY; + packetID = ID_WORLD_REGION_AUTHORITY; priority = IMMEDIATE_PRIORITY; reliability = RELIABLE_ORDERED; } -void mwmp::PacketPlayerRegionAuthority::Packet(RakNet::BitStream *bs, bool send) +void mwmp::PacketWorldRegionAuthority::Packet(RakNet::BitStream *bs, bool send) { PlayerPacket::Packet(bs, send); - // Placeholder to be filled in later + RW(player->authorityRegion, send, true); } diff --git a/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.hpp b/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.hpp deleted file mode 100644 index 8180b79f7..000000000 --- a/components/openmw-mp/Packets/Player/PacketPlayerRegionAuthority.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP -#define OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP - -#include - -namespace mwmp -{ - class PacketPlayerRegionAuthority : public PlayerPacket - { - public: - PacketPlayerRegionAuthority(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, bool send); - }; -} - -#endif //OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP diff --git a/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.cpp b/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.cpp new file mode 100644 index 000000000..82e7adfd7 --- /dev/null +++ b/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.cpp @@ -0,0 +1,16 @@ +#include +#include "PacketWorldRegionAuthority.hpp" + +mwmp::PacketWorldRegionAuthority::PacketWorldRegionAuthority(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer) +{ + packetID = ID_WORLD_REGION_AUTHORITY; + priority = IMMEDIATE_PRIORITY; + reliability = RELIABLE_ORDERED; +} + +void mwmp::PacketWorldRegionAuthority::Packet(RakNet::BitStream *bs, bool send) +{ + WorldstatePacket::Packet(bs, send); + + RW(worldstate->authorityRegion, send, true); +} diff --git a/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.hpp b/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.hpp new file mode 100644 index 000000000..0069aa324 --- /dev/null +++ b/components/openmw-mp/Packets/Worldstate/PacketWorldRegionAuthority.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETWORLDREGIONAUTHORITY_HPP +#define OPENMW_PACKETWORLDREGIONAUTHORITY_HPP + +#include + +namespace mwmp +{ + class PacketWorldRegionAuthority : public WorldstatePacket + { + public: + PacketWorldRegionAuthority(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETWORLDREGIONAUTHORITY_HPP