2019-03-22 19:33:34 +00:00
|
|
|
#include "PacketCellReset.hpp"
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketCellReset::PacketCellReset(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_CELL_RESET;
|
|
|
|
orderChannel = CHANNEL_SYSTEM;
|
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketCellReset::Packet(RakNet::BitStream *newBitstream, bool send)
|
2019-03-22 19:33:34 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
WorldstatePacket::Packet(newBitstream, send);
|
2019-03-22 19:33:34 +00:00
|
|
|
|
2019-03-24 12:19:46 +00:00
|
|
|
uint32_t cellCount;
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
cellCount = static_cast<uint32_t>(worldstate->cellsToReset.size());
|
|
|
|
|
|
|
|
RW(cellCount, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
worldstate->cellsToReset.clear();
|
|
|
|
worldstate->cellsToReset.resize(cellCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &&cellToReset : worldstate->cellsToReset)
|
|
|
|
{
|
|
|
|
RW(cellToReset.mData, send, true);
|
|
|
|
RW(cellToReset.mName, send, true);
|
|
|
|
}
|
2019-03-22 19:33:34 +00:00
|
|
|
}
|