1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 20:49:56 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerAlly.cpp
David Cernat 980edac942 [General] Rename PlayerTeam into PlayerAlly
Considering that you can be allies with someone without being allied to their allies, changing the name makes the system more intuitive.
2019-12-05 19:15:11 +02:00

30 lines
693 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerAlly.hpp"
mwmp::PacketPlayerAlly::PacketPlayerAlly(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_ALLY;
}
void mwmp::PacketPlayerAlly::Packet(RakNet::BitStream *newBitstream, bool send)
{
PlayerPacket::Packet(newBitstream, send);
uint32_t count;
if (send)
count = static_cast<uint32_t>(player->alliedPlayers.size());
RW(count, send);
if (!send)
{
player->alliedPlayers.clear();
player->alliedPlayers.resize(count);
}
for (auto &&teamPlayerGuid : player->alliedPlayers)
{
RW(teamPlayerGuid, send, true);
}
}