1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 23:19:56 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Object/PacketConsoleCommand.cpp

35 lines
860 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketConsoleCommand.hpp"
using namespace mwmp;
PacketConsoleCommand::PacketConsoleCommand(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
{
packetID = ID_CONSOLE_COMMAND;
hasCellData = true;
}
void PacketConsoleCommand::Packet(RakNet::BitStream *bs, bool send)
{
if (!PacketHeader(bs, send))
return;
RW(objectList->consoleCommand, send);
BaseObject baseObject;
for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
{
if (send)
baseObject = objectList->baseObjects.at(i);
RW(baseObject.isPlayer, send);
if (baseObject.isPlayer)
RW(baseObject.guid, send);
else
Object(baseObject, send);
if (!send)
objectList->baseObjects.push_back(baseObject);
}
}