2016-10-24 14:52:19 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketVideoPlay.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketVideoPlay::PacketVideoPlay(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
|
|
|
{
|
2016-10-25 09:15:27 +00:00
|
|
|
packetID = ID_VIDEO_PLAY;
|
2016-10-24 14:52:19 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketVideoPlay::Packet(RakNet::BitStream *bs, bool send)
|
2016-10-24 14:52:19 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
WorldPacket::Packet(bs, send);
|
2016-10-24 14:52:19 +00:00
|
|
|
|
2017-05-24 19:09:35 +00:00
|
|
|
if (send)
|
2017-05-06 18:57:14 +00:00
|
|
|
event->worldObjectCount = (unsigned int)(event->worldObjects.size());
|
2017-05-24 19:09:35 +00:00
|
|
|
else
|
|
|
|
event->worldObjects.clear();
|
2017-01-28 10:34:45 +00:00
|
|
|
|
2017-05-06 18:57:14 +00:00
|
|
|
RW(event->worldObjectCount, send);
|
2017-01-28 10:34:45 +00:00
|
|
|
|
2017-06-01 22:35:32 +00:00
|
|
|
if (event->worldObjectCount > maxObjects)
|
|
|
|
{
|
|
|
|
event->isValid = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-28 10:34:45 +00:00
|
|
|
WorldObject worldObject;
|
|
|
|
|
2017-05-06 18:57:14 +00:00
|
|
|
for (unsigned int i = 0; i < event->worldObjectCount; i++)
|
2017-01-28 10:34:45 +00:00
|
|
|
{
|
|
|
|
if (send)
|
|
|
|
{
|
2017-05-06 18:57:14 +00:00
|
|
|
worldObject = event->worldObjects.at(i);
|
2017-01-28 10:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RW(worldObject.filename, send);
|
|
|
|
RW(worldObject.allowSkipping, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
2017-05-06 18:57:14 +00:00
|
|
|
event->worldObjects.push_back(worldObject);
|
2017-01-28 10:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-24 14:52:19 +00:00
|
|
|
}
|