mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 09:23:51 +00:00
3acfbad55d
For starters, the new packet can set which client scripts have all of their variables synchronized between players. The previous hardcoded list of IDs for synchronized scripts has been removed.
33 lines
900 B
C++
33 lines
900 B
C++
#include "PacketClientScriptSettings.hpp"
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketClientScriptSettings::PacketClientScriptSettings(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
|
{
|
|
packetID = ID_CLIENT_SCRIPT_SETTINGS;
|
|
orderChannel = CHANNEL_WORLDSTATE;
|
|
}
|
|
|
|
void PacketClientScriptSettings::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
WorldstatePacket::Packet(bs, send);
|
|
|
|
uint32_t clientScriptsCount;
|
|
|
|
if (send)
|
|
clientScriptsCount = static_cast<uint32_t>(worldstate->synchronizedClientScriptIds.size());
|
|
|
|
RW(clientScriptsCount, send);
|
|
|
|
if (!send)
|
|
{
|
|
worldstate->synchronizedClientScriptIds.clear();
|
|
worldstate->synchronizedClientScriptIds.resize(clientScriptsCount);
|
|
}
|
|
|
|
for (auto &&clientScriptId : worldstate->synchronizedClientScriptIds)
|
|
{
|
|
RW(clientScriptId, send);
|
|
}
|
|
}
|