Skip to content

Commit

Permalink
Only incidents of preferred drivers are noted when "Focus on prefered…
Browse files Browse the repository at this point in the history
… Drivers" is set in the configuration dialog
  • Loading branch information
MerlinCooper committed Jan 3, 2021
1 parent e36ef27 commit 3d66d8d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Phases/Analysis/Incident.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using iRacingReplayDirector.Phases.Direction.Support;

namespace iRacingReplayDirector.Phases.Analysis
{
Expand Down Expand Up @@ -49,14 +50,34 @@ public override string ToString()

public void Process(DataSample data)
{
//

if (data.Telemetry.CamCar.TrackSurface == TrackLocation.InPitStall ||
data.Telemetry.CamCar.TrackSurface == TrackLocation.NotInWorld ||
data.Telemetry.CamCar.TrackSurface == TrackLocation.AproachingPits)
{
TraceInfo.WriteLine("{0} Ignoring incident in the pits on lap {1}", data.Telemetry.SessionTimeSpan, data.Telemetry.RaceLaps);
return;
}

//when FocusOnPrefered drivers is selected and current data not belongs to driver listed as prefered driver
if (Settings.Default.FocusOnPreferedDriver && !Battle.GetPreferredCarIdxs(data, Settings.Default.PreferredDrivers).Contains(data.Telemetry.CamCar.Details.CarIdx))
{
TraceInfo.WriteLine("{0} Ignoring incident of car {1} because FocusOnPrefered driver active", data.Telemetry.SessionTimeSpan, data.Telemetry.CamCar.Details.Driver.UserName);
return;
/********* Clean-up *****************
//check whether incident belongs to driver in preferred drivers list.
//bool isPreferred = Array.Exists(preferedCarIdxs, data.Telemetry.CamCar.Details.CarIdx);
long curCarLdx = data.Telemetry.CamCar.Details.CarIdx;
long[] preferedCarIdxs = Battle.GetPreferredCarIdxs(data, Settings.Default.PreferredDrivers);
//bool isPreferred = preferedCarIdxs.Contains(curCarLdx);
bool isPreferred = Battle.GetPreferredCarIdxs(data, Settings.Default.PreferredDrivers).Contains(curCarLdx);
******** end clean-up **********/
}

var i = new Incident
{
LapNumber = data.Telemetry.RaceLaps,
Expand Down

0 comments on commit 3d66d8d

Please sign in to comment.