mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-22 04:23:50 +00:00
672bb707a7
# Conflicts: # apps/openmw-mp/Networking.cpp # apps/openmw-mp/Networking.hpp # apps/openmw-mp/Script/Functions/World.cpp # apps/openmw-mp/processors/WorldProcessor.cpp # apps/openmw-mp/processors/WorldProcessor.hpp # apps/openmw-mp/processors/world/ProcessorContainer.hpp # apps/openmw-mp/processors/world/ProcessorDoorState.hpp # apps/openmw-mp/processors/world/ProcessorObjectDelete.hpp # apps/openmw-mp/processors/world/ProcessorObjectLock.hpp # apps/openmw-mp/processors/world/ProcessorObjectPlace.hpp # apps/openmw-mp/processors/world/ProcessorObjectScale.hpp # apps/openmw-mp/processors/world/ProcessorObjectSpawn.hpp # apps/openmw-mp/processors/world/ProcessorObjectState.hpp # apps/openmw-mp/processors/world/ProcessorObjectTrap.hpp # apps/openmw/mwmp/Networking.cpp # components/CMakeLists.txt # components/openmw-mp/Controllers/ObjectPacketController.hpp # components/openmw-mp/Controllers/WorldPacketController.cpp # components/openmw-mp/Packets/Object/ObjectPacket.cpp # components/openmw-mp/Packets/Object/ObjectPacket.hpp # components/openmw-mp/Packets/Object/PacketConsoleCommand.hpp # components/openmw-mp/Packets/Object/PacketContainer.hpp # components/openmw-mp/Packets/Object/PacketDoorState.hpp # components/openmw-mp/Packets/Object/PacketMusicPlay.hpp # components/openmw-mp/Packets/Object/PacketObjectAnimPlay.hpp # components/openmw-mp/Packets/Object/PacketObjectDelete.hpp # components/openmw-mp/Packets/Object/PacketObjectLock.hpp # components/openmw-mp/Packets/Object/PacketObjectMove.hpp # components/openmw-mp/Packets/Object/PacketObjectPlace.hpp # components/openmw-mp/Packets/Object/PacketObjectRotate.hpp # components/openmw-mp/Packets/Object/PacketObjectScale.hpp # components/openmw-mp/Packets/Object/PacketObjectSpawn.hpp # components/openmw-mp/Packets/Object/PacketObjectState.hpp # components/openmw-mp/Packets/Object/PacketObjectTrap.hpp # components/openmw-mp/Packets/Object/PacketScriptGlobalShort.hpp # components/openmw-mp/Packets/Object/PacketScriptLocalFloat.hpp # components/openmw-mp/Packets/Object/PacketScriptLocalShort.hpp # components/openmw-mp/Packets/Object/PacketScriptMemberShort.hpp # components/openmw-mp/Packets/Object/PacketVideoPlay.hpp
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include <components/openmw-mp/Log.hpp>
|
|
#include "PacketContainer.hpp"
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketContainer::PacketContainer(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
|
{
|
|
packetID = ID_CONTAINER;
|
|
hasCellData = true;
|
|
}
|
|
|
|
void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
if (!PacketHeader(bs, send))
|
|
return;
|
|
|
|
RW(event->action, send);
|
|
RW(event->containerSubAction, send);
|
|
|
|
for (auto &&worldObject : event->worldObjects)
|
|
{
|
|
Object(worldObject, send);
|
|
|
|
if (send)
|
|
{
|
|
worldObject.containerItemCount = (unsigned int) (worldObject.containerItems.size());
|
|
}
|
|
|
|
RW(worldObject.containerItemCount, send);
|
|
|
|
if (!send)
|
|
{
|
|
worldObject.containerItems.clear();
|
|
worldObject.containerItems.resize(worldObject.containerItemCount);
|
|
}
|
|
|
|
if (worldObject.containerItemCount > maxObjects || worldObject.refId.empty()
|
|
|| (worldObject.refNumIndex != 0 && worldObject.mpNum != 0))
|
|
{
|
|
event->isValid = false;
|
|
return;
|
|
}
|
|
|
|
for (auto &&containerItem: worldObject.containerItems)
|
|
{
|
|
RW(containerItem.refId, send);
|
|
RW(containerItem.count, send);
|
|
RW(containerItem.charge, send);
|
|
RW(containerItem.enchantmentCharge, send);
|
|
RW(containerItem.actionCount, send);
|
|
}
|
|
}
|
|
}
|