mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 15:19:55 +00:00
a13cef9913
# 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
34 lines
813 B
C++
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);
|
|
}
|
|
}
|