mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 20:49:56 +00:00
23684489da
Converting integer literal to bool, use bool literal instead
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include "PacketPlayerFaction.hpp"
|
|
|
|
using namespace std;
|
|
using namespace mwmp;
|
|
|
|
PacketPlayerFaction::PacketPlayerFaction(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
{
|
|
packetID = ID_PLAYER_FACTION;
|
|
}
|
|
|
|
void PacketPlayerFaction::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
PlayerPacket::Packet(bs, send);
|
|
|
|
RW(player->factionChanges.action, send);
|
|
|
|
if (send)
|
|
player->factionChanges.count = (unsigned int)(player->factionChanges.factions.size());
|
|
else
|
|
player->factionChanges.factions.clear();
|
|
|
|
RW(player->factionChanges.count, send);
|
|
|
|
for (unsigned int i = 0; i < player->factionChanges.count; i++)
|
|
{
|
|
Faction faction;
|
|
|
|
if (send)
|
|
faction = player->factionChanges.factions.at(i);
|
|
|
|
RW(faction.factionId, send, true);
|
|
|
|
if (player->factionChanges.action == FactionChanges::RANK)
|
|
RW(faction.rank, send);
|
|
|
|
if (player->factionChanges.action == FactionChanges::EXPULSION)
|
|
RW(faction.isExpelled, send);
|
|
|
|
if (player->factionChanges.action == FactionChanges::REPUTATION)
|
|
RW(faction.reputation, send);
|
|
|
|
if (!send)
|
|
player->factionChanges.factions.push_back(faction);
|
|
}
|
|
}
|