forked from teamnwah/openmw-tes3coop
[General] Add PreInit packet
parent
0d53a6916d
commit
0c1905e842
@ -0,0 +1,38 @@
|
||||
//
|
||||
// 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, RakNet::RakNetGUID &guid, bool send, PluginContainer &checksums)
|
||||
{
|
||||
BasePacket::Packet(bs, guid, send);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Created by koncord on 05.03.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PACKETPREINIT_HPP
|
||||
#define OPENMW_PACKETPREINIT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "BasePacket.hpp"
|
||||
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPreInit : public BasePacket
|
||||
{
|
||||
public:
|
||||
typedef std::pair<std::string, unsigned int> PluginPair;
|
||||
typedef std::vector<PluginPair> PluginContainer;
|
||||
|
||||
PacketPreInit(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, RakNet::RakNetGUID &guid, bool send, PluginContainer &checksums);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PACKETPREINIT_HPP
|
Loading…
Reference in New Issue