[Client] Improve logic for updating LocalActors & sending their packets

0.6.1
David Cernat 8 years ago
parent 9e25a95861
commit de8d28e2c3

@ -54,16 +54,22 @@ void ActorList::addDrawStateActor(LocalActor localActor)
void ActorList::sendPositionActors()
{
baseActors = positionActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->Send();
if (positionActors.size() > 0)
{
baseActors = positionActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->Send();
}
}
void ActorList::sendDrawStateActors()
{
baseActors = drawStateActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->Send();
if (drawStateActors.size() > 0)
{
baseActors = drawStateActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->Send();
}
}
// TODO: Finish this

@ -45,7 +45,9 @@ void Cell::updateLocal(bool forceUpdate)
}
else
{
actor->update(forceUpdate);
if (actor->getPtr().getRefData().isEnabled())
actor->update(forceUpdate);
++it;
}
}

@ -15,7 +15,8 @@ using namespace std;
DedicatedActor::DedicatedActor()
{
drawState = 0;
movementFlags = 0;
}
DedicatedActor::~DedicatedActor()

@ -66,7 +66,7 @@ void LocalActor::updateDrawStateAndFlags(bool forceUpdate)
bool isForceMoveJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
isFlying = world->isFlying(ptr);
bool isJumping = ptr.getRefData().isEnabled() && !world->isOnGround(ptr) && !isFlying;
bool isJumping = !world->isOnGround(ptr) && !isFlying;
MWMechanics::DrawState_ currentDrawState = ptr.getClass().getNpcStats(ptr).getDrawState();

Loading…
Cancel
Save