You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3coop/components/openmw-mp/Packets/Player/PacketPlayerBook.cpp

36 lines
833 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerBook.hpp"
using namespace std;
using namespace mwmp;
PacketPlayerBook::PacketPlayerBook(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_BOOK;
}
void PacketPlayerBook::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
if (send)
player->bookChanges.count = (unsigned int)(player->bookChanges.books.size());
else
player->bookChanges.books.clear();
RW(player->bookChanges.count, send);
for (unsigned int i = 0; i < player->bookChanges.count; i++)
{
Book book;
if (send)
book = player->bookChanges.books.at(i);
RW(book.bookId, send, true);
if (!send)
player->bookChanges.books.push_back(book);
}
}