2017-01-26 11:49:20 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketPlayerCellState.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
mwmp::PacketPlayerCellState::PacketPlayerCellState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_PLAYER_CELL_STATE;
|
|
|
|
priority = IMMEDIATE_PRIORITY;
|
|
|
|
reliability = RELIABLE_ORDERED;
|
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void mwmp::PacketPlayerCellState::Packet(RakNet::BitStream *bs, bool send)
|
2017-01-26 11:49:20 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
PlayerPacket::Packet(bs, send);
|
2017-01-26 11:49:20 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
uint32_t count;
|
|
|
|
|
2017-05-24 19:09:35 +00:00
|
|
|
if (send)
|
2017-11-28 13:37:46 +00:00
|
|
|
count = static_cast<uint32_t>(player->cellStateChanges.cellStates.size());
|
2017-01-26 11:49:20 +00:00
|
|
|
|
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(count, send);
|
|
|
|
|
2017-11-29 11:00:22 +00:00
|
|
|
if (!send)
|
2017-01-26 11:49:20 +00:00
|
|
|
{
|
2017-11-28 13:37:46 +00:00
|
|
|
player->cellStateChanges.cellStates.clear();
|
|
|
|
player->cellStateChanges.cellStates.resize(count);
|
|
|
|
}
|
2017-01-26 11:49:20 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
for (auto &&cellState : player->cellStateChanges.cellStates)
|
|
|
|
{
|
2017-02-03 18:27:40 +00:00
|
|
|
RW(cellState.type, send);
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(cellState.cell.mData, send, true);
|
|
|
|
RW(cellState.cell.mName, send, true);
|
2017-01-26 11:49:20 +00:00
|
|
|
}
|
|
|
|
}
|