Update player markers only when getting a position packet

coverity_scan^2
David Cernat 8 years ago
parent 7f98cddfdf
commit d93e66207e

@ -220,8 +220,6 @@ void DedicatedPlayer::Move(float dt)
void Players::Update(float dt) void Players::Update(float dt)
{ {
static float timer = 0;
timer += dt;
for (std::map <uint64_t, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++) for (std::map <uint64_t, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++)
{ {
DedicatedPlayer *pl = it->second; DedicatedPlayer *pl = it->second;
@ -262,12 +260,7 @@ void Players::Update(float dt)
ptrNpcStats->setBaseDisposition(255); ptrNpcStats->setBaseDisposition(255);
pl->Move(dt); pl->Move(dt);
pl->UpdateDrawState(); pl->UpdateDrawState();
if (timer >= 0.2) // call every 200 msec
pl->updateMarker();
} }
if (timer >= 0.2)
timer = 0;
} }
void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr) void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr)

@ -243,7 +243,10 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
getLocalPlayer()->updatePosition(true); getLocalPlayer()->updatePosition(true);
} }
else if (pl != 0) else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false); myPacket->Packet(&bsIn, pl, false);
pl->updateMarker();
}
break; break;
} }
case ID_USER_MYID: case ID_USER_MYID:

Loading…
Cancel
Save