private static void UpdateTrackLocation(Simulation sim, IEntitySessionResult result, TrackLocation newLocation) { if (newLocation == result.Entity.Car.Movement.TrackLocation) { return; } ((CarMovement)result.Entity.Car.Movement).TrackLocation = newLocation; if (newLocation == TrackLocation.OffTrack) { var ev = new SessionEvent(result.CurrentLap.ReplayPosition, "Off Track", result.Entity, sim.CameraManager.CurrentGroup, result.Session.Type, SessionEventType.OffTrack, result.CurrentLap.Number); lock (sim.SharedCollectionLock) { ((Session.Session)sim.Session).SessionEventsInt.Add(ev); } sim.Triggers.Push(new TriggerInfo { CarIdx = result.Entity.CarIdx, Type = EventType.OffTrack }); } else if (newLocation == TrackLocation.NotInWorld) { sim.Triggers.Push(new TriggerInfo { CarIdx = result.Entity.CarIdx, Type = EventType.NotInWorld }); } }
private void FillMissingLaps(IEntitySessionResult result) { if (Items.Count == 0) { return; } // Add initial laps we missed if (Items[0].Number > 1) { for (int i = Items[0].Number - 1; i > 0; i--) { var lap = new CompletedLap(result); lap.Number = i; lap.SetExactLaptime(-1); Map[i] = lap; Items.Insert(0, lap); } } if (Items.Count > 2) { var last = Items[Items.Count - 1].Number; var secondToLast = Items[Items.Count - 2].Number; for (int i = secondToLast + 1; i < last; i++) { var lap = new CompletedLap(result); lap.Number = i; lap.SetExactLaptime(-1); Map[i] = lap; Items.Insert(Items.Count - 1, lap); } } }