differentiation btw _lastEdited and _lastSimulated

This commit is contained in:
Andrew Meadows 2014-12-15 14:28:53 -08:00
parent fd8e3f6169
commit 0f488bca02
2 changed files with 8 additions and 4 deletions

View file

@ -458,7 +458,8 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
ByteCountCoded<quint64> updateDeltaCoder = encodedUpdateDelta;
quint64 updateDelta = updateDeltaCoder;
if (overwriteLocalData) {
_lastSimulated = _lastUpdated = lastEditedFromBufferAdjusted + updateDelta; // don't adjust for clock skew since we already did that for _lastEdited
_lastUpdated = lastEditedFromBufferAdjusted + updateDelta; // don't adjust for clock skew since we already did that for _lastEdited
_lastSimulated = now;
if (wantDebug) {
qDebug() << "_lastUpdated =" << _lastUpdated;
qDebug() << "_lastEdited=" << _lastEdited;
@ -619,8 +620,6 @@ void EntityItem::simulate(const quint64& now) {
}
}
_lastSimulated = now;
if (wantDebug) {
qDebug() << " ********** EntityItem::update() .... SETTING _lastSimulated=" << _lastSimulated;
}
@ -730,6 +729,8 @@ void EntityItem::simulate(const quint64& now) {
}
}
}
_lastSimulated = now;
}
bool EntityItem::isMoving() const {
@ -819,6 +820,9 @@ bool EntityItem::setProperties(const EntityItemProperties& properties, bool forc
"now=" << now << " getLastEdited()=" << getLastEdited();
}
setLastEdited(properties._lastEdited);
if (getDirtyFlags() & EntityItem::DIRTY_POSITION) {
_lastSimulated = usecTimestampNow();
}
}
return somethingChanged;

View file

@ -86,7 +86,7 @@ public:
/// Last edited time of this entity universal usecs
quint64 getLastEdited() const { return _lastEdited; }
void setLastEdited(quint64 lastEdited)
{ _lastEdited = _lastSimulated = _lastUpdated = lastEdited; _changedOnServer = glm::max(lastEdited, _changedOnServer); }
{ _lastEdited = _lastUpdated = lastEdited; _changedOnServer = glm::max(lastEdited, _changedOnServer); }
float getEditedAgo() const /// Elapsed seconds since this entity was last edited
{ return (float)(usecTimestampNow() - getLastEdited()) / (float)USECS_PER_SECOND; }