/// <summary> /// If necissary, update toUpdate with this. /// </summary> /// <param name="toUpdate">LastSeen that may need an update</param> /// <returns>true iff an update was performed</returns> public bool update(ref LastSeen toUpdate) { if (this.LastSeenAt > toUpdate.LastSeenAt || this.LastBroadcast > toUpdate.LastBroadcast || this.LastJam > toUpdate.LastJam || this.LastRadar > toUpdate.LastRadar || this.RadarInfoTicks() > toUpdate.RadarInfoTicks()) { toUpdate = new LastSeen(this, toUpdate); return(true); } return(false); }
private LastSeen(LastSeen first, LastSeen second) { this.Info = first.RadarInfoTicks() > second.RadarInfoTicks() ? first.Info : second.Info; LastSeen newer, older; if (first.LastSeenAt > second.LastSeenAt) { newer = first; older = second; } else { newer = second; older = first; } this.Entity = newer.Entity; this.LastSeenAt = newer.LastSeenAt; this.LastKnownPosition = newer.LastKnownPosition; this.LastKnownVelocity = newer.LastKnownVelocity; this.m_lastBroadcast = new OlderBy(this.LastSeenAt.Ticks, Math.Max(first.LastBroadcast, second.LastBroadcast)); this.m_lastJam = new OlderBy(this.LastSeenAt.Ticks, Math.Max(first.LastJam, second.LastJam)); this.m_lastRadar = new OlderBy(this.LastSeenAt.Ticks, Math.Max(first.LastRadar, second.LastRadar)); if (first.m_type == EntityType.None) { this.m_type = second.m_type; } else { this.m_type = first.m_type; } value_isValid = true; }