2017-07-10 09:33:53 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketConsoleCommand.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2018-05-12 16:40:00 +00:00
|
|
|
PacketConsoleCommand::PacketConsoleCommand(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
2017-07-10 09:33:53 +00:00
|
|
|
{
|
|
|
|
packetID = ID_CONSOLE_COMMAND;
|
2019-07-19 17:10:28 +00:00
|
|
|
hasCellData = true;
|
2017-07-10 09:33:53 +00:00
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketConsoleCommand::Packet(RakNet::BitStream *newBitstream, bool send)
|
2017-07-10 09:33:53 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
if (!PacketHeader(newBitstream, send))
|
2017-11-22 22:21:47 +00:00
|
|
|
return;
|
|
|
|
|
2019-12-07 06:47:35 +00:00
|
|
|
RW(objectList->consoleCommand, send, true);
|
2017-11-22 22:21:47 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
BaseObject baseObject;
|
|
|
|
for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
|
2017-11-22 22:21:47 +00:00
|
|
|
{
|
|
|
|
if (send)
|
2018-05-12 21:42:24 +00:00
|
|
|
baseObject = objectList->baseObjects.at(i);
|
2017-11-22 22:21:47 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.isPlayer, send);
|
2017-11-22 22:21:47 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
if (baseObject.isPlayer)
|
|
|
|
RW(baseObject.guid, send);
|
2017-11-22 22:21:47 +00:00
|
|
|
else
|
2018-05-12 21:42:24 +00:00
|
|
|
Object(baseObject, send);
|
2017-11-22 22:21:47 +00:00
|
|
|
|
|
|
|
if (!send)
|
2018-05-12 21:42:24 +00:00
|
|
|
objectList->baseObjects.push_back(baseObject);
|
2017-11-22 22:21:47 +00:00
|
|
|
}
|
2017-07-10 09:33:53 +00:00
|
|
|
}
|