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

This commit is contained in:
David Cernat 2017-04-13 18:59:22 +03:00
parent 9e25a95861
commit de8d28e2c3
4 changed files with 18 additions and 9 deletions

View file

@ -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

View file

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

View file

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

View file

@ -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();