1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 03:53:52 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerMap.cpp
2017-11-28 21:38:45 +08:00

34 lines
793 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerMap.hpp"
using namespace std;
using namespace mwmp;
PacketPlayerMap::PacketPlayerMap(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_MAP;
}
void PacketPlayerMap::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
uint32_t count;
if (send)
count = static_cast<uint32_t>(player->mapChanges.cellsExplored.size());
RW(count, send);
if(!send)
{
player->mapChanges.cellsExplored.clear();
player->mapChanges.cellsExplored.resize(count);
}
for (auto &&cellExplored : player->mapChanges.cellsExplored)
{
RW(cellExplored.mData, send, true);
RW(cellExplored.mName, send, true);
}
}