[General] Turn PlayerRegionAuthority into WorldRegionAuthority

WorldRegionAuthority is a Worldstate packet.
This commit is contained in:
David Cernat 2018-07-17 09:21:13 +03:00
parent d5d3c0937f
commit 9823a77bf2
13 changed files with 81 additions and 55 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -47,6 +47,8 @@ namespace mwmp
bool hasPlacedObjectCollision;
bool useActorCollisionForPlacedObjects;
std::string authorityRegion;
std::vector<std::string> enforcedCollisionRefIds;
std::vector<MapTile> mapTiles;

View file

@ -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<PacketPlayerMomentum>(&packets, peer);
AddPacket<PacketPlayerPosition>(&packets, peer);
AddPacket<PacketPlayerQuickKeys>(&packets, peer);
AddPacket<PacketPlayerRegionAuthority>(&packets, peer);
AddPacket<PacketPlayerReputation>(&packets, peer);
AddPacket<PacketPlayerRest>(&packets, peer);
AddPacket<PacketPlayerResurrect>(&packets, peer);

View file

@ -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<PacketRecordDynamic>(&packets, peer);
AddPacket<PacketWorldCollisionOverride>(&packets, peer);
AddPacket<PacketWorldMap>(&packets, peer);
AddPacket<PacketWorldRegionAuthority>(&packets, peer);
AddPacket<PacketWorldTime>(&packets, peer);
AddPacket<PacketWorldWeather>(&packets, peer);
}

View file

@ -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,

View file

@ -1,16 +1,16 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#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);
}

View file

@ -1,17 +0,0 @@
#ifndef OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP
#define OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
namespace mwmp
{
class PacketPlayerRegionAuthority : public PlayerPacket
{
public:
PacketPlayerRegionAuthority(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETPLAYERREGIONAUTHORITY_HPP

View file

@ -0,0 +1,16 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#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);
}

View file

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETWORLDREGIONAUTHORITY_HPP
#define OPENMW_PACKETWORLDREGIONAUTHORITY_HPP
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
namespace mwmp
{
class PacketWorldRegionAuthority : public WorldstatePacket
{
public:
PacketWorldRegionAuthority(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETWORLDREGIONAUTHORITY_HPP