1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 16:49:55 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerMap.cpp

37 lines
927 B
C++
Raw Normal View History

#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);
if (send)
player->mapChanges.count = (unsigned int)(player->mapChanges.cellsExplored.size());
else
player->mapChanges.cellsExplored.clear();
RW(player->mapChanges.count, send);
for (unsigned int i = 0; i < player->mapChanges.count; i++)
{
ESM::Cell cellExplored;
if (send)
cellExplored = player->mapChanges.cellsExplored.at(i);
RW(cellExplored.mData, send, 1);
RW(cellExplored.mName, send, 1);
if (!send)
player->mapChanges.cellsExplored.push_back(cellExplored);
}
}