2018-05-25 04:09:32 +00:00
|
|
|
#include "PacketWorldCollisionOverride.hpp"
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketWorldCollisionOverride::PacketWorldCollisionOverride(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_WORLD_COLLISION_OVERRIDE;
|
|
|
|
orderChannel = CHANNEL_WORLDSTATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PacketWorldCollisionOverride::Packet(RakNet::BitStream *bs, bool send)
|
|
|
|
{
|
|
|
|
WorldstatePacket::Packet(bs, send);
|
|
|
|
|
2018-05-27 13:05:40 +00:00
|
|
|
RW(worldstate->hasPlayerCollision, send);
|
|
|
|
RW(worldstate->hasActorCollision, send);
|
|
|
|
RW(worldstate->hasPlacedObjectCollision, send);
|
|
|
|
RW(worldstate->useActorCollisionForPlacedObjects, send);
|
2018-06-28 01:53:00 +00:00
|
|
|
|
|
|
|
uint32_t enforcedCollisionCount;
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
enforcedCollisionCount = static_cast<uint32_t>(worldstate->enforcedCollisionRefIds.size());
|
|
|
|
|
|
|
|
RW(enforcedCollisionCount, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
worldstate->enforcedCollisionRefIds.clear();
|
|
|
|
worldstate->enforcedCollisionRefIds.resize(enforcedCollisionCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &&enforcedCollisionRefId : worldstate->enforcedCollisionRefIds)
|
|
|
|
{
|
|
|
|
RW(enforcedCollisionRefId, send);
|
|
|
|
}
|
2018-05-25 04:09:32 +00:00
|
|
|
}
|