1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 15:19:55 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Worldstate/PacketCellReset.cpp
David Cernat a13cef9913 Merge branch '0.7.0reset' of https://github.com/uramer/openmw into 0.7.1
# Conflicts:
#	apps/openmw-mp/Script/Functions/Worldstate.cpp
#	apps/openmw-mp/Script/Functions/Worldstate.hpp
#	apps/openmw/mwbase/world.hpp
#	apps/openmw/mwmp/CellController.cpp
#	apps/openmw/mwworld/cellstore.cpp
#	apps/openmw/mwworld/worldimp.cpp
#	apps/openmw/mwworld/worldimp.hpp
2020-02-11 15:41:38 +02:00

34 lines
813 B
C++

#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;
}
void PacketCellReset::Packet(RakNet::BitStream *newBitstream, bool send)
{
WorldstatePacket::Packet(newBitstream, send);
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);
}
}