mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-05-04 06:11:28 +00:00
[General] Add PreInit packet
This commit is contained in:
parent
0d53a6916d
commit
0c1905e842
4 changed files with 68 additions and 2 deletions
|
@ -173,7 +173,7 @@ add_component_dir (openmw-mp
|
||||||
Packets/World/PacketVideoPlay
|
Packets/World/PacketVideoPlay
|
||||||
|
|
||||||
Packets/World/PacketScriptLocalShort Packets/World/PacketScriptLocalFloat Packets/World/PacketScriptMemberShort
|
Packets/World/PacketScriptLocalShort Packets/World/PacketScriptLocalFloat Packets/World/PacketScriptMemberShort
|
||||||
Packets/World/PacketScriptGlobalShort)
|
Packets/World/PacketScriptGlobalShort Packets/PacketPreInit)
|
||||||
|
|
||||||
add_component_dir (fallback
|
add_component_dir (fallback
|
||||||
fallback validate
|
fallback validate
|
||||||
|
|
|
@ -58,7 +58,8 @@ enum GameMessages
|
||||||
ID_SCRIPT_MEMBER_SHORT,
|
ID_SCRIPT_MEMBER_SHORT,
|
||||||
ID_SCRIPT_GLOBAL_SHORT,
|
ID_SCRIPT_GLOBAL_SHORT,
|
||||||
|
|
||||||
ID_GAME_CONSOLE
|
ID_GAME_CONSOLE,
|
||||||
|
ID_GAME_PREINIT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
38
components/openmw-mp/Packets/PacketPreInit.cpp
Normal file
38
components/openmw-mp/Packets/PacketPreInit.cpp
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
components/openmw-mp/Packets/PacketPreInit.hpp
Normal file
27
components/openmw-mp/Packets/PacketPreInit.hpp
Normal file
|
@ -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 a new issue