[General] Minor cleanup of the Actor Packets

new-script-api
Koncord 7 years ago
parent e44fcdc0b3
commit 744b8cf168

@ -43,7 +43,7 @@ mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *pee
mwmp::ActorPacket *mwmp::ActorPacketController::GetPacket(RakNet::MessageID id)
{
return packets[(unsigned char)id].get();
return packets[(RakNet::MessageID)id].get();
}
void mwmp::ActorPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)

@ -18,7 +18,7 @@ namespace mwmp
bool ContainsPacket(RakNet::MessageID id);
typedef std::unordered_map<unsigned char, std::unique_ptr<ActorPacket> > packets_t;
typedef std::unordered_map<RakNet::MessageID, std::unique_ptr<ActorPacket> > packets_t;
private:
packets_t packets;
};

@ -53,8 +53,8 @@ bool ActorPacket::PacketHeader(RakNet::BitStream *bs, bool send)
{
BasePacket::Packet(bs, send);
RW(actorList->cell.mData, send, 1);
RW(actorList->cell.mName, send, 1);
RW(actorList->cell.mData, send, true);
RW(actorList->cell.mName, send, true);
if (send)
actorList->count = (unsigned int)(actorList->baseActors.size());

@ -12,6 +12,6 @@ void PacketActorAuthority::Packet(RakNet::BitStream *bs, bool send)
{
BasePacket::Packet(bs, send);
RW(actorList->cell.mData, send, 1);
RW(actorList->cell.mName, send, 1);
RW(actorList->cell.mData, send, true);
RW(actorList->cell.mName, send, true);
}

@ -11,9 +11,9 @@ PacketActorCellChange::PacketActorCellChange(RakNet::RakPeerInterface *peer) : A
void PacketActorCellChange::Actor(BaseActor &actor, bool send)
{
RW(actor.cell.mData, send, 1);
RW(actor.cell.mName, send, 1);
RW(actor.cell.mData, send, true);
RW(actor.cell.mName, send, true);
RW(actor.position, send, 1);
RW(actor.direction, send, 1);
RW(actor.position, send, true);
RW(actor.direction, send, true);
}

@ -11,10 +11,10 @@ PacketActorEquipment::PacketActorEquipment(RakNet::RakPeerInterface *peer) : Act
void PacketActorEquipment::Actor(BaseActor &actor, bool send)
{
for (int j = 0; j < 19; j++)
for (auto &&equipedItem : actor.equipedItems)
{
RW(actor.equipedItems[j].refId, send);
RW(actor.equipedItems[j].count, send);
RW(actor.equipedItems[j].charge, send);
RW(equipedItem.refId, send);
RW(equipedItem.count, send);
RW(equipedItem.charge, send);
}
}

@ -11,8 +11,8 @@ PacketActorPosition::PacketActorPosition(RakNet::RakPeerInterface *peer) : Actor
void PacketActorPosition::Actor(BaseActor &actor, bool send)
{
RW(actor.position, send, 1);
RW(actor.direction, send, 1);
RW(actor.position, send, true);
RW(actor.direction, send, true);
actor.hasPositionData = true;
}

Loading…
Cancel
Save