Only send position if client game tick advanced as well

ryzomclassic-develop
kaetemi 3 years ago
parent c8ecf0a756
commit 20ed0a4412
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -187,6 +187,8 @@ CUserEntity::CUserEntity()
_MoveToDist= 0.0; _MoveToDist= 0.0;
_MoveToColStartTime= 0; _MoveToColStartTime= 0;
_LastSentClientTick = 0;
_FollowForceHeadPitch= false; _FollowForceHeadPitch= false;
_ForceLookSlot= CLFECOMMON::INVALID_SLOT; _ForceLookSlot= CLFECOMMON::INVALID_SLOT;
@ -1705,6 +1707,10 @@ void CUserEntity::moveToAction(CEntityCL *ent)
//----------------------------------------------- //-----------------------------------------------
bool CUserEntity::sendToServer(CBitMemStream &out) bool CUserEntity::sendToServer(CBitMemStream &out)
{ {
if (NetMngr.getCurrentClientTick() == _LastSentClientTick)
{
return false;
}
if(GenericMsgHeaderMngr.pushNameToStream("POSITION", out)) if(GenericMsgHeaderMngr.pushNameToStream("POSITION", out))
{ {
// Backup the position sent. // Backup the position sent.
@ -1717,6 +1723,7 @@ bool CUserEntity::sendToServer(CBitMemStream &out)
positionMsg.Z = (sint32)(pos().z * 1000); positionMsg.Z = (sint32)(pos().z * 1000);
positionMsg.Heading = frontYaw(); positionMsg.Heading = frontYaw();
out.serial(positionMsg); out.serial(positionMsg);
_LastSentClientTick = NetMngr.getCurrentClientTick();
return true; return true;
} }
else else

@ -606,6 +606,8 @@ protected:
/// Time in MS when the User started beiing in collision with anything that avoid him to do an Action (and still is). /// Time in MS when the User started beiing in collision with anything that avoid him to do an Action (and still is).
sint64 _MoveToColStartTime; sint64 _MoveToColStartTime;
NLMISC::TGameCycle _LastSentClientTick;
/// CSkill points observer /// CSkill points observer
class CSkillPointsObserver : public NLMISC::ICDBNode::IPropertyObserver class CSkillPointsObserver : public NLMISC::ICDBNode::IPropertyObserver

Loading…
Cancel
Save