2016-11-20 20:54:49 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketMusicPlay.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketMusicPlay::PacketMusicPlay(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
|
|
|
{
|
2016-11-20 22:03:41 +00:00
|
|
|
packetID = ID_MUSIC_PLAY;
|
2016-11-20 20:54:49 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketMusicPlay::Packet(RakNet::BitStream *bs, bool send)
|
2016-11-20 20:54:49 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
WorldPacket::Packet(bs, send);
|
2016-11-20 20:54:49 +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
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
2017-05-06 18:57:14 +00:00
|
|
|
event->worldObjects.push_back(worldObject);
|
2017-01-28 10:34:45 +00:00
|
|
|
}
|
|
|
|
}
|
2016-11-20 20:54:49 +00:00
|
|
|
}
|