forked from mirror/openmw-tes3mp
[General] Simplify ActorPackets
This commit is contained in:
parent
fd8e833d6a
commit
2ed1bfe427
26 changed files with 104 additions and 429 deletions
|
@ -26,9 +26,49 @@ void ActorPacket::setActorList(BaseActorList *actorList)
|
|||
}
|
||||
|
||||
void ActorPacket::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
if(!PacketHeader(bs, send))
|
||||
return;
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
actor = actorList->baseActors[i];
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
Actor(actor, send);
|
||||
|
||||
if (!send)
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
|
||||
bool ActorPacket::PacketHeader(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
BasePacket::Packet(bs, send);
|
||||
|
||||
RW(actorList->cell.mData, send, 1);
|
||||
RW(actorList->cell.mName, send, 1);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
actorList->isValid = false;
|
||||
|
||||
return actorList->isValid;
|
||||
}
|
||||
|
||||
|
||||
void ActorPacket::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@ namespace mwmp
|
|||
~ActorPacket();
|
||||
|
||||
void setActorList(BaseActorList *actorList);
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
protected:
|
||||
bool PacketHeader(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
BaseActorList *actorList;
|
||||
static const int maxActors = 3000;
|
||||
};
|
||||
|
|
|
@ -9,40 +9,7 @@ PacketActorAI::PacketActorAI(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
|||
packetID = ID_ACTOR_AI;
|
||||
}
|
||||
|
||||
void PacketActorAI::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorAI::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
// Placeholder to be filled in later
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
// Placeholder to be filled in later
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorAI(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,42 +9,9 @@ PacketActorAnimFlags::PacketActorAnimFlags(RakNet::RakPeerInterface *peer) : Act
|
|||
packetID = ID_ACTOR_ANIM_FLAGS;
|
||||
}
|
||||
|
||||
void PacketActorAnimFlags::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorAnimFlags::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.movementFlags, send);
|
||||
RW(actor.drawState, send);
|
||||
RW(actor.isFlying, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
RW(actor.movementFlags, send);
|
||||
RW(actor.drawState, send);
|
||||
RW(actor.isFlying, send);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorAnimFlags(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,43 +9,11 @@ PacketActorAnimPlay::PacketActorAnimPlay(RakNet::RakPeerInterface *peer) : Actor
|
|||
packetID = ID_ACTOR_ANIM_PLAY;
|
||||
}
|
||||
|
||||
void PacketActorAnimPlay::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorAnimPlay::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.animation.groupname, send);
|
||||
RW(actor.animation.mode, send);
|
||||
RW(actor.animation.count, send);
|
||||
RW(actor.animation.persist, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
RW(actor.animation.groupname, send);
|
||||
RW(actor.animation.mode, send);
|
||||
RW(actor.animation.count, send);
|
||||
RW(actor.animation.persist, send);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorAnimPlay(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,51 +9,18 @@ PacketActorAttack::PacketActorAttack(RakNet::RakPeerInterface *peer) : ActorPack
|
|||
packetID = ID_ACTOR_ATTACK;
|
||||
}
|
||||
|
||||
void PacketActorAttack::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorAttack::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
RW(actor.attack.target.refNumIndex, send);
|
||||
RW(actor.attack.target.mpNum, send);
|
||||
RW(actor.attack.target.guid, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
RW(actor.attack.spellId, send);
|
||||
RW(actor.attack.type, send);
|
||||
RW(actor.attack.success, send);
|
||||
RW(actor.attack.damage, send);
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.attack.target.refNumIndex, send);
|
||||
RW(actor.attack.target.mpNum, send);
|
||||
RW(actor.attack.target.guid, send);
|
||||
|
||||
RW(actor.attack.spellId, send);
|
||||
RW(actor.attack.type, send);
|
||||
RW(actor.attack.success, send);
|
||||
RW(actor.attack.damage, send);
|
||||
|
||||
RW(actor.attack.pressed, send);
|
||||
RW(actor.attack.knockdown, send);
|
||||
RW(actor.attack.block, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
RW(actor.attack.pressed, send);
|
||||
RW(actor.attack.knockdown, send);
|
||||
RW(actor.attack.block, send);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorAttack(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,5 +10,8 @@ PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : Act
|
|||
|
||||
void PacketActorAuthority::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
BasePacket::Packet(bs, send);
|
||||
|
||||
RW(actorList->cell.mData, send, 1);
|
||||
RW(actorList->cell.mName, send, 1);
|
||||
}
|
||||
|
|
|
@ -9,40 +9,11 @@ PacketActorCellChange::PacketActorCellChange(RakNet::RakPeerInterface *peer) : A
|
|||
packetID = ID_ACTOR_CELL_CHANGE;
|
||||
}
|
||||
|
||||
void PacketActorCellChange::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorCellChange::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
RW(actor.cell.mData, send, 1);
|
||||
RW(actor.cell.mName, send, 1);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
actor = actorList->baseActors.at(i);
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.cell.mData, send, 1);
|
||||
RW(actor.cell.mName, send, 1);
|
||||
|
||||
RW(actor.position, send, 1);
|
||||
RW(actor.direction, send, 1);
|
||||
|
||||
if (!send)
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
RW(actor.position, send, 1);
|
||||
RW(actor.direction, send, 1);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorCellChange(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,40 +9,7 @@ PacketActorDeath::PacketActorDeath(RakNet::RakPeerInterface *peer) : ActorPacket
|
|||
packetID = ID_ACTOR_DEATH;
|
||||
}
|
||||
|
||||
void PacketActorDeath::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorDeath::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
// Placeholder to be filled in later
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorDeath(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,45 +9,12 @@ PacketActorEquipment::PacketActorEquipment(RakNet::RakPeerInterface *peer) : Act
|
|||
packetID = ID_ACTOR_EQUIPMENT;
|
||||
}
|
||||
|
||||
void PacketActorEquipment::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorEquipment::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
for (int j = 0; j < 19; j++)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
for (int j = 0; j < 19; j++)
|
||||
{
|
||||
RW(actor.equipedItems[j].refId, send);
|
||||
RW(actor.equipedItems[j].count, send);
|
||||
RW(actor.equipedItems[j].charge, send);
|
||||
}
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
RW(actor.equipedItems[j].refId, send);
|
||||
RW(actor.equipedItems[j].count, send);
|
||||
RW(actor.equipedItems[j].charge, send);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorEquipment(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,31 +10,17 @@ PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : ActorPacket(p
|
|||
|
||||
void PacketActorList::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
if(!ActorPacket::PacketHeader(bs, send))
|
||||
return;
|
||||
|
||||
RW(actorList->action, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
|
@ -47,8 +33,6 @@ void PacketActorList::Packet(RakNet::BitStream *bs, bool send)
|
|||
}
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,39 +9,10 @@ PacketActorPosition::PacketActorPosition(RakNet::RakPeerInterface *peer) : Actor
|
|||
packetID = ID_ACTOR_POSITION;
|
||||
}
|
||||
|
||||
void PacketActorPosition::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorPosition::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
RW(actor.position, send, 1);
|
||||
RW(actor.direction, send, 1);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
actor = actorList->baseActors.at(i);
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.position, send, 1);
|
||||
RW(actor.direction, send, 1);
|
||||
|
||||
actor.hasPositionData = true;
|
||||
|
||||
if (!send)
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
actor.hasPositionData = true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorPosition(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,41 +9,8 @@ PacketActorSpeech::PacketActorSpeech(RakNet::RakPeerInterface *peer) : ActorPack
|
|||
packetID = ID_ACTOR_SPEECH;
|
||||
}
|
||||
|
||||
void PacketActorSpeech::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorSpeech::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.response, send);
|
||||
RW(actor.sound, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
RW(actor.response, send);
|
||||
RW(actor.sound, send);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorSpeech(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -10,44 +10,9 @@ PacketActorStatsDynamic::PacketActorStatsDynamic(RakNet::RakPeerInterface *peer)
|
|||
packetID = ID_ACTOR_STATS_DYNAMIC;
|
||||
}
|
||||
|
||||
void PacketActorStatsDynamic::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorStatsDynamic::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
RW(actor.creatureStats.mDynamic, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.creatureStats.mDynamic[0], send); // health
|
||||
RW(actor.creatureStats.mDynamic[1], send); // magic
|
||||
RW(actor.creatureStats.mDynamic[2], send); // fatigue
|
||||
|
||||
actor.hasStatsDynamicData = true;
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
actor.hasStatsDynamicData = true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorStatsDynamic(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,38 +9,7 @@ PacketActorTest::PacketActorTest(RakNet::RakPeerInterface *peer) : ActorPacket(p
|
|||
packetID = ID_ACTOR_TEST;
|
||||
}
|
||||
|
||||
void PacketActorTest::Packet(RakNet::BitStream *bs, bool send)
|
||||
void PacketActorTest::Actor(BaseActor &actor, bool send)
|
||||
{
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
actorList->count = (unsigned int)(actorList->baseActors.size());
|
||||
else
|
||||
actorList->baseActors.clear();
|
||||
|
||||
RW(actorList->count, send);
|
||||
|
||||
if (actorList->count > maxActors)
|
||||
{
|
||||
actorList->isValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < actorList->count; i++)
|
||||
{
|
||||
if (send)
|
||||
{
|
||||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
actorList->baseActors.push_back(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace mwmp
|
|||
public:
|
||||
PacketActorTest(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
virtual void Actor(BaseActor &actor, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue