[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

@ -53,18 +53,24 @@ void ActorList::addDrawStateActor(LocalActor localActor)
} }
void ActorList::sendPositionActors() void ActorList::sendPositionActors()
{
if (positionActors.size() > 0)
{ {
baseActors = positionActors; baseActors = positionActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->setActorList(this); Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->Send(); Main::get().getNetworking()->getActorPacket(ID_ACTOR_POSITION)->Send();
} }
}
void ActorList::sendDrawStateActors() void ActorList::sendDrawStateActors()
{
if (drawStateActors.size() > 0)
{ {
baseActors = drawStateActors; baseActors = drawStateActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->setActorList(this); Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->Send(); Main::get().getNetworking()->getActorPacket(ID_ACTOR_DRAW_STATE)->Send();
} }
}
// TODO: Finish this // TODO: Finish this
void ActorList::editActorsInCell(MWWorld::CellStore* cellStore) void ActorList::editActorsInCell(MWWorld::CellStore* cellStore)

View file

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

View file

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

View file

@ -66,7 +66,7 @@ void LocalActor::updateDrawStateAndFlags(bool forceUpdate)
bool isForceMoveJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump); bool isForceMoveJumping = ptrNpcStats.getMovementFlag(CreatureStats::Flag_ForceMoveJump);
isFlying = world->isFlying(ptr); 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(); MWMechanics::DrawState_ currentDrawState = ptr.getClass().getNpcStats(ptr).getDrawState();