1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00
openmw-tes3mp/components/openmw-mp/Packets/PacketPreInit.cpp

39 lines
910 B
C++
Raw Normal View History

2017-03-05 08:46:11 +00:00
//
// Created by koncord on 05.03.17.
//
#include <components/openmw-mp/NetworkMessages.hpp>
#include <boost/foreach.hpp>
#include "PacketPreInit.hpp"
mwmp::PacketPreInit::PacketPreInit(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{
packetID = ID_GAME_PREINIT;
}
void mwmp::PacketPreInit::Packet(RakNet::BitStream *bs, bool send, PluginContainer &checksums)
2017-03-05 08:46:11 +00:00
{
BasePacket::Packet(bs, send);
2017-03-05 08:46:11 +00:00
unsigned int size = checksums.size();
RW(size, send);
if(send)
{
BOOST_FOREACH(PluginContainer::value_type & checksum, checksums)
{
RW(checksum.first, true);
RW(checksum.second, true);
}
}
else
{
for(unsigned int i = 0; i < size; i++)
{
PluginPair checksum;
RW(checksum.first, false);
RW(checksum.second, false);
checksums.push_back(checksum);
}
}
}