Exemple #1
0
 private int sortDriver(IDriverGeneral d1, IDriverGeneral d2)
 {
     if (d1 == null || d2 == null)
     {
         return(0);
     }
     if (d1.Position == d2.Position)
     {
         return(0);
     }
     if (d1.Position > 120 || d1.Position == 0)
     {
         return(1);
     }
     if (d2.Position > 120 || d2.Position == 0)
     {
         return(-1);
     }
     if (d1.Position > d2.Position)
     {
         return(1);
     }
     else
     {
         return(-1);
     }
 }
Exemple #2
0
        private void SetLap(IDriverGeneral driver, Lap l)
        {
            int i = TrackLogger.FindIndex(lm => l.LapNo == lm.LapNo && l.DriverNo == lm.DriverNo);

            if (i < 0)
            {
                TrackLogger.Add(l);
            }
            else
            {
                TrackLogger[i] = l;
            }
        }
Exemple #3
0
        public double GetSplitTime(IDriverGeneral _player)
        {
            DriverGeneral player = (DriverGeneral)_player;
            //return 1;
            int lapsbase_leader = player.__LapsData.ToInt32();

            if (lapsbase_leader == 0)
            {
                return(1000000f);
            }
            int lapsbase = __LapsData.ToInt32();

            int sectors_leader   = player.SectorsDriven;
            int sectors_follower = SectorsDriven;

            bool ahead = false;
            int  plus  = 0;

            if (player.Laps - this.Laps == 1)
            {
                if (player.MetersDriven > this.MetersDriven && sectors_leader - 2 >= sectors_follower)
                {
                    return(10000);
                }
            }
            if (player.Laps - this.Laps > 1)
            {
                ahead = true;
            }

            if (ahead)
            {
                if (player.MetersDriven < this.MetersDriven)
                {
                    sectors_leader--;
                }
                return(10000 * (plus + Math.Floor((sectors_leader - sectors_follower) / 3.0)));
            }

            // Get the most accurate sectors
            // get both race time values for this sector
            double sector_leader   = GetSectorRaceTime(lapsbase_leader, sectors_follower);
            double sector_follower = GetSectorRaceTime(lapsbase, sectors_follower);

            return(sector_follower - sector_leader);
        }
Exemple #4
0
        public Lap GetLap(IDriverGeneral driver, int offset)
        {
            int        lap = driver.Laps - offset;
            int        drv = driver.MemoryBlock;
            List <Lap> l   = TrackLogger.Where(lm => lm.LapNo == lap && lm.DriverNo == drv).ToList();

            if (l.Count == 0)
            {
                return new Lap {
                           LapNo = -1
                }
            }
            ;
            else
            {
                return(l[0]);
            }
        }
Exemple #5
0
 public double GetSplitTime(IDriverGeneral player)
 {
     return(10);
 }
Exemple #6
0
        public double GetSplitTime(IDriverGeneral _player)
        {
            DriverGeneral player = (DriverGeneral) _player;
            //return 1;
            int lapsbase_leader =player.__LapsData.ToInt32();
            if (lapsbase_leader == 0)
                return 1000000f;
            int lapsbase = __LapsData.ToInt32();

            int sectors_leader = player.SectorsDriven ;
            int sectors_follower = SectorsDriven;

            bool ahead = false;
            int plus = 0;

            if (player.Laps - this.Laps == 1)
            {
                if (player.MetersDriven > this.MetersDriven && sectors_leader - 2 >= sectors_follower)
                {
                    return 10000;
                }
            }
            if (player.Laps - this.Laps > 1)
                ahead = true;

            if (ahead)
            {
                if (player.MetersDriven < this.MetersDriven)
                    sectors_leader--;
                return 10000 * (plus + Math.Floor((sectors_leader - sectors_follower) / 3.0));
            }

            // Get the most accurate sectors
            // get both race time values for this sector
            double sector_leader = GetSectorRaceTime(lapsbase_leader, sectors_follower);
            double sector_follower = GetSectorRaceTime(lapsbase, sectors_follower);
            return sector_follower - sector_leader;
        }
Exemple #7
0
 private int sortDriver(IDriverGeneral d1,IDriverGeneral d2)
 {
     if (d1.Position == d2.Position) return 0;
     if (d1.Position > 120 || d1.Position == 0) return 1;
     if (d2.Position > 120 || d2.Position == 0) return -1;
     if (d1.Position > d2.Position) return 1;
     else return -1;
 }
Exemple #8
0
        private void SetLap(IDriverGeneral driver, Lap l)
        {
            int i = TrackLogger.FindIndex(lm => l.LapNo == lm.LapNo && l.DriverNo == lm.DriverNo);

            if (i < 0) TrackLogger.Add(l);
            else TrackLogger[i] = l;
        }
Exemple #9
0
        public Lap GetLap(IDriverGeneral driver, int offset)
        {
            int lap = driver.Laps - offset;
            int drv = driver.MemoryBlock;
            List<Lap> l = TrackLogger.Where(lm => lm.LapNo == lap && lm.DriverNo == drv).ToList();

            if (l.Count == 0) return new Lap { LapNo = -1 };
            else return l[0];
        }
Exemple #10
0
        public static IDriverGeneral Create(IDriverGeneral player)
        {
            NetworkDriverGeneral nwGeneral = new NetworkDriverGeneral();

            // TODO: Make a object copy machine.
            nwGeneral.Driving        = player.Driving;
            nwGeneral.Ignition       = player.Ignition;
            nwGeneral.MemoryBlock    = player.MemoryBlock;
            nwGeneral.SectorsDriven  = player.SectorsDriven;
            nwGeneral.Active         = player.Active;
            nwGeneral.IsPlayer       = player.IsPlayer;
            nwGeneral.Name           = player.Name;
            nwGeneral.BaseAddress    = player.BaseAddress;
            nwGeneral.CoordinateX    = player.CoordinateX;
            nwGeneral.CoordinateY    = player.CoordinateY;
            nwGeneral.CoordinateZ    = player.CoordinateZ;
            nwGeneral.Throttle       = player.Throttle;
            nwGeneral.Brake          = player.Brake;
            nwGeneral.Fuel           = player.Fuel;
            nwGeneral.CarModel       = player.CarModel;
            nwGeneral.CarClass       = player.CarClass;
            nwGeneral.Control_AI_Aid = player.Control_AI_Aid;
            nwGeneral.PitLimiter     = player.PitLimiter;
            nwGeneral.Pits           = player.Pits;
            nwGeneral.HeadLights     = player.HeadLights;
            nwGeneral.Laps           = player.Laps;
            nwGeneral.MetersDriven   = player.MetersDriven;
            nwGeneral.Pitstops       = player.Pitstops;
            nwGeneral.Retired        = player.Retired;
            nwGeneral.TrackPosition  = player.TrackPosition;
            nwGeneral.SteeringHelp   = player.SteeringHelp;
            nwGeneral.Mass           = player.Mass;
            nwGeneral.Speed          = player.Speed;
            nwGeneral.RPM            = player.RPM;
            nwGeneral.RPM_Max        = player.RPM_Max;
            nwGeneral.Position       = player.Position;
            nwGeneral.Gear           = player.Gear;
            nwGeneral.GearRatio1     = player.GearRatio1;
            nwGeneral.GearRatio2     = player.GearRatio2;
            nwGeneral.GearRatio3     = player.GearRatio3;
            nwGeneral.GearRatio4     = player.GearRatio4;
            nwGeneral.GearRatio5     = player.GearRatio5;
            nwGeneral.GearRatio6     = player.GearRatio6;
            nwGeneral.GearRatio7     = player.GearRatio7;
            nwGeneral.GearRatio8     = player.GearRatio8;
            nwGeneral.GearRatio9     = player.GearRatio9;
            nwGeneral.GearRatio10    = player.GearRatio10;
            nwGeneral.GearRatio11    = player.GearRatio11;
            nwGeneral.GearRatio12    = player.GearRatio12;
            nwGeneral.GearRatio13    = player.GearRatio13;
            nwGeneral.GearRatio14    = player.GearRatio14;
            nwGeneral.GearRatio15    = player.GearRatio15;
            nwGeneral.GearRatio16    = player.GearRatio16;
            nwGeneral.GearRatio17    = player.GearRatio17;
            nwGeneral.GearRatio18    = player.GearRatio18;
            nwGeneral.GearRatioR     = player.GearRatioR;
            nwGeneral.Flag_Blue      = player.Flag_Blue;
            nwGeneral.Flag_Yellow    = player.Flag_Yellow;
            nwGeneral.Flag_Black     = player.Flag_Black;
            // TODO: Copy wheel info.
            return(nwGeneral);
        }
 public double GetSplitTime(IDriverGeneral player)
 {
     return 0;
     throw new NotImplementedException();
 }
        public static IDriverGeneral Create(IDriverGeneral player)
        {
            NetworkDriverGeneral nwGeneral = new NetworkDriverGeneral();

            // TODO: Make a object copy machine.
            nwGeneral.Driving = player.Driving;
            nwGeneral.Ignition = player.Ignition;
            nwGeneral.MemoryBlock = player.MemoryBlock;
            nwGeneral.SectorsDriven = player.SectorsDriven;
            nwGeneral.Active = player.Active;
            nwGeneral.IsPlayer = player.IsPlayer;
            nwGeneral.Name = player.Name;
            nwGeneral.BaseAddress = player.BaseAddress;
            nwGeneral.CoordinateX = player.CoordinateX;
            nwGeneral.CoordinateY = player.CoordinateY;
            nwGeneral.CoordinateZ = player.CoordinateZ;
            nwGeneral.Throttle = player.Throttle;
            nwGeneral.Brake = player.Brake;
            nwGeneral.Fuel = player.Fuel;
            nwGeneral.CarModel = player.CarModel;
            nwGeneral.CarClass = player.CarClass;
            nwGeneral.Control_AI_Aid = player.Control_AI_Aid;
            nwGeneral.PitLimiter = player.PitLimiter;
            nwGeneral.Pits = player.Pits;
            nwGeneral.HeadLights = player.HeadLights;
            nwGeneral.Laps = player.Laps;
            nwGeneral.MetersDriven = player.MetersDriven;
            nwGeneral.Pitstops = player.Pitstops;
            nwGeneral.Retired = player.Retired;
            nwGeneral.TrackPosition = player.TrackPosition;
            nwGeneral.SteeringHelp = player.SteeringHelp;
            nwGeneral.Mass = player.Mass;
            nwGeneral.Speed = player.Speed;
            nwGeneral.RPM = player.RPM;
            nwGeneral.RPM_Max = player.RPM_Max;
            nwGeneral.Position = player.Position;
            nwGeneral.Gear = player.Gear;
            nwGeneral.GearRatio1 = player.GearRatio1;
            nwGeneral.GearRatio2 = player.GearRatio2;
            nwGeneral.GearRatio3 = player.GearRatio3;
            nwGeneral.GearRatio4 = player.GearRatio4;
            nwGeneral.GearRatio5 = player.GearRatio5;
            nwGeneral.GearRatio6 = player.GearRatio6;
            nwGeneral.GearRatio7 = player.GearRatio7;
            nwGeneral.GearRatio8 = player.GearRatio8;
            nwGeneral.GearRatio9 = player.GearRatio9;
            nwGeneral.GearRatio10 = player.GearRatio10;
            nwGeneral.GearRatio11 = player.GearRatio11;
            nwGeneral.GearRatio12 = player.GearRatio12;
            nwGeneral.GearRatio13 = player.GearRatio13;
            nwGeneral.GearRatio14 = player.GearRatio14;
            nwGeneral.GearRatio15 = player.GearRatio15;
            nwGeneral.GearRatio16 = player.GearRatio16;
            nwGeneral.GearRatio17 = player.GearRatio17;
            nwGeneral.GearRatio18 = player.GearRatio18;
            nwGeneral.GearRatioR = player.GearRatioR;
            nwGeneral.Flag_Blue = player.Flag_Blue;
            nwGeneral.Flag_Yellow = player.Flag_Yellow;
            nwGeneral.Flag_Black = player.Flag_Black;
            // TODO: Copy wheel info.
            return nwGeneral;
        }
Exemple #13
0
        void UpdateDrivers_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (rFactor.Simulator.UseMemoryReader)
                {
                    // TODO: Match car to MMF instead
                    if (rFactor.Session.Cars != PrevCars || PrevCars != _AllDrivers.Count)
                    {
                        lock (_AllDrivers)
                        {
                            _AllDrivers.Clear();

                            int dpos = 0;
                            // Create XX drivers
                            for (int i = 0; i < MaxCars; i++)
                            {
                                int pos = rFactor.Game.ReadInt32(new IntPtr(0x04 * i + 0x715298));
                                int d = pos - dpos;
                                dpos = pos;
                                DriverGeneral c = new DriverGeneral(pos);
                                if (pos != 0 && c.Name != "" && c.Position > 0 && c.Position < 120)
                                    _AllDrivers.Add(c);
                            }
                            if (_AllDrivers.Count == 0)
                                _AllDrivers.Add(new DriverGeneral(0x7154C0));
                        }

                        if (_AllDrivers.Count(x => x.IsPlayer) == 1)
                            _player = _AllDrivers.Where(x => x.IsPlayer).FirstOrDefault();
                        else if (_AllDrivers.Count(x => x.BaseAddress == 0x7154C0) == 1)
                            _player = _AllDrivers.Where(x => x.BaseAddress == 0x7154C0).FirstOrDefault();
                        else if (_AllDrivers.Count > 0)
                            _player = _AllDrivers.FirstOrDefault();
                        else
                            _player = null;

                        PrevCars = rFactor.Session.Cars;
                    }

                }
            else
            {
                /*
                try
                {
                    lock (_AllDrivers)
                    {
                        if (rFactor.Session.Cars != PrevCars || PrevCars != _AllDrivers.Count)
                        {
                            _AllDrivers.Clear();
                            
                            for (int i = 0; i < rFactor.MMF.Telemetry.Session.Cars; i++)
                            {
                                _AllDrivers.Add(new DriverGeneral(rFactor.MMF.Drivers[i]));
                            }
                            if (_AllDrivers.Count == 0)
                                _player = null;
                            else
                                _player = _AllDrivers.Where(x => x.IsPlayer).FirstOrDefault();

                            PrevCars = rFactor.Session.Cars;
                        }
                        else
                        {
                            for (int i = 0; i < rFactor.MMF.Telemetry.Session.Cars; i++)
                            {
                                _AllDrivers[i] = new DriverGeneral(rFactor.MMF.Drivers[i]);
                            }
                        }

                    }
                }
                catch (Exception ex)
                {

                }*/
            }
        }
Exemple #14
0
        protected override void OnPaint(PaintEventArgs e)
        {
            this.Size = new Size(460, this.Size.Height);
            Graphics g = e.Graphics;

            g.FillRectangle(Brushes.Black, e.ClipRectangle);
            if (!Telemetry.m.Active_Session)
            {
                return;
            }

            // Draw header
            System.Drawing.Font f = new Font("Arial", 8, FontStyle.Regular);

            try
            {
                switch (Telemetry.m.Sim.Session.Type.Type)
                {
                default:
                    g.DrawString("P", f, Brushes.DarkGray, 10f, 10f);
                    g.DrawString("Name", f, Brushes.DarkGray, 38f, 10f);
                    g.DrawString("Lap", f, Brushes.DarkGray, 140f, 10f);
                    g.DrawString("Interval", f, Brushes.DarkGray, 195f, 10f);
                    g.DrawString("S1", f, Brushes.DarkGray, 245f, 10f);
                    g.DrawString("S2", f, Brushes.DarkGray, 295f, 10f);
                    g.DrawString("S3", f, Brushes.DarkGray, 345f, 10f);
                    g.DrawString("Laps", f, Brushes.DarkGray, 395f, 10f);

                    break;

                case SessionType.RACE:
                    g.DrawString("P", f, Brushes.DarkGray, 10f, 10f);
                    g.DrawString("Name", f, Brushes.DarkGray, 38f, 10f);
                    g.DrawString("Gap", f, Brushes.DarkGray, 140f, 10f);
                    g.DrawString("Interval", f, Brushes.DarkGray, 165f, 10f);
                    g.DrawString("Lap", f, Brushes.DarkGray, 222f, 10f);
                    g.DrawString("S1", f, Brushes.DarkGray, 245f, 10f);
                    g.DrawString("S2", f, Brushes.DarkGray, 295f, 10f);
                    g.DrawString("S3", f, Brushes.DarkGray, 345f, 10f);
                    g.DrawString("Pit", f, Brushes.DarkGray, 395f, 10f);

                    break;
                }
                int   ind        = 1;
                float LineHeight = 15f;

                List <IDriverGeneral> drivers = Telemetry.m.Sim.Drivers.AllDrivers;
                drivers.Sort(sortDriver);

                double lapTimeBest = 10000;
                int    driverIndex = 0;

                float BestSector1 = 1000f;
                float BestSector2 = 1000f;
                float BestSector3 = 1000f;

                float MyBestSector1 = 1000f;
                float MyBestSector2 = 1000f;
                float MyBestSector3 = 1000f;

                int BestSector1Position = 0;
                int BestSector2Position = 0;
                int BestSector3Position = 0;

                float  FastestLap    = 1000f;
                string FastestDriver = "";
                int    DriverCount   = 0;
                // get all time best sector times
                if (Telemetry.m.Sim.Modules.Times_History_LapTimes)
                {
                    List <ILap> mylaps = Telemetry.m.Sim.Drivers.Player.GetLapTimes();
                    foreach (ILap l in mylaps)
                    {
                        if (l.Sector1 > 0.1 && l.Sector2 > 0.1 && l.Sector3 > 0.1)
                        {
                            MyBestSector1 = Math.Min(MyBestSector1, l.Sector1);
                            MyBestSector2 = Math.Min(MyBestSector2, l.Sector2);
                            MyBestSector3 = Math.Min(MyBestSector3, l.Sector3);
                        }
                    }
                }

                foreach (IDriverGeneral driver in drivers)
                {
                    if (driver.Position != 0 && driver.Position <= 120 && Math.Abs(driver.CoordinateX) >= 0.1)
                    {
                        driverIndex++;
                        //if (driver.Position >= 120 || driver.Position == 0) continue;
                        //if (driver.Name.Trim() == "") continue;

                        // fastest lap
                        DriverCount++;
                        ILap fastlap = driver.GetBestLap();


                        if (fastlap != null && fastlap.LapTime < FastestLap && fastlap.LapTime > 0)
                        {
                            FastestLap    = fastlap.LapTime;
                            FastestDriver = driver.Name;
                        }
                        if (driver.LapTime_Best_Sector1 > 0)
                        {
                            if (BestSector1 > driver.LapTime_Best_Sector1)
                            {
                                BestSector1         = driver.LapTime_Best_Sector1;
                                BestSector1Position = driver.Position;
                            }
                        }
                        if (driver.LapTime_Best_Sector2 > 0)
                        {
                            if (BestSector2 > driver.LapTime_Best_Sector2)
                            {
                                BestSector2         = driver.LapTime_Best_Sector2;
                                BestSector2Position = driver.Position;
                            }
                        }
                        //BestSector2 = Math.Min(BestSector2, driver.LapTime_Best_Sector2);
                        if (driver.LapTime_Best_Sector3 > 0)
                        {
                            if (BestSector3 > driver.LapTime_Best_Sector3)
                            {
                                BestSector3         = driver.LapTime_Best_Sector3;
                                BestSector3Position = driver.Position;
                            }
                            //BestSector3 = Math.Min(BestSector3, driver.LapTime_Best_Sector3);
                        }
                    }
                }
                driverIndex = 0;

                if (DriverCount < 16)
                {
                    LineHeight = 20f;
                }
                else
                {
                    LineHeight = Math.Max(10, Convert.ToSingle((this.Size.Height - 20) / (4.0 + DriverCount)));
                }


                // Go through all drivers
                if (drivers.Count > 0)
                {
                    IDriverGeneral Lastdriver           = drivers[0];
                    double         Previous_SplitLeader = 0;
                    foreach (IDriverGeneral driver in drivers)
                    {
                        driverIndex++;
                        Lastdriver = driver;
                        if (ind * LineHeight > this.Size.Height - 20 - 3 * 20)
                        {
                            break;
                        }

                        if (Math.Abs(driver.CoordinateX) < 0.1)
                        {
                            continue;
                        }
                        //if (driver.Position >= 120 || driver.Position == 0 || driver.__LapsData.ToInt32() == 0) continue;
                        //if (driver.Name.Trim() == "")
                        //    continue;
                        Brush OntrackBrush = ((!driver.Pits && driver.Speed > 5) ? Brushes.White : Brushes.Red);
                        g.DrawString(driver.Position.ToString(), f, Brushes.White, 10f, 10f + ind * LineHeight);
                        string[] name = driver.Name.ToUpper().Split(" ".ToCharArray());
                        if (name.Length == 1)
                        {
                            g.DrawString(name[0], f, OntrackBrush, 38f, 10f + ind * LineHeight);
                        }
                        else if (name.Length > 1)
                        {
                            g.DrawString(name[0].Substring(0, 1) + ". " + name[name.Length - 1], f, OntrackBrush, 38f,
                                         10f + ind * LineHeight);
                        }

                        if (!LastPitLap.ContainsKey(driver.Name))
                        {
                            LastPitLap.Add(driver.Name, -1);
                        }
                        if (driver.Pits)
                        {
                            LastPitLap[driver.Name] = driver.Laps;
                        }

                        if (Telemetry.m.Sim.Session.Type.Type == SessionType.RACE)
                        {
                            if (driver.LapTime_Last < lapTimeBest && driver.LapTime_Last != -1f)
                            {
                                lapTimeBest = driver.LapTime_Last;
                            }
                            if (driver.LapTime_Last != -1f)
                            {
                                g.DrawString(PrintLapTime(driver.LapTime_Last, false), f, Brushes.White, 140f,
                                             10f + ind * LineHeight);
                            }

                            if (driver.Position == 1)
                            {
                                g.DrawString("LAP " + drivers[0].Laps, f, Brushes.Yellow, 190f, 10f + ind * LineHeight);
                            }
                            else
                            {
                                double split_leader = driver.GetSplitTime(drivers[0]);
                                if (split_leader >= 10000)
                                {
                                    int laps = Convert.ToInt32(split_leader / 10000);
                                    if (laps < 100)
                                    {
                                        g.DrawString("+" + laps + "L", f, Brushes.Yellow, 190f, 10f + ind * LineHeight);
                                    }
                                    else
                                    {
                                        g.DrawString("???", f, Brushes.Yellow, 190f, 10f + ind * LineHeight);
                                    }
                                }
                                else
                                {
                                    g.DrawString(Math.Round(split_leader, 1).ToString(), f, Brushes.White, 190f,
                                                 10f + ind * LineHeight);
                                }

                                double split_next = split_leader - Previous_SplitLeader;
                                Previous_SplitLeader = split_leader;
                                if (split_next < 1000 && split_next > 0)
                                {
                                    g.DrawString(Math.Round(split_next, 1).ToString(), f, Brushes.White, 220f,
                                                 10f + ind * LineHeight);
                                }
                                else if (split_next > 0)
                                {
                                    int laps = Convert.ToInt32(split_next / 10000);
                                    g.DrawString("+" + laps + "L", f, Brushes.Yellow, 220f, 10f + ind * LineHeight);
                                }
                            }


                            if (driver.Pits && driver.Sector_1_Best > 0)
                            {
                                Brush Sector1Brush = Brushes.Yellow;
                                Brush Sector2Brush = Brushes.Yellow;
                                Brush Sector3Brush = Brushes.Yellow;
                                if (driver.Sector_1_Best <= BestSector1)
                                {
                                    Sector1Brush = Brushes.Magenta;
                                }
                                if (driver.Sector_2_Best <= BestSector2)
                                {
                                    Sector2Brush = Brushes.Magenta;
                                }
                                if (driver.Sector_3_Best <= BestSector3)
                                {
                                    Sector3Brush = Brushes.Magenta;
                                }
                                g.DrawString(PrintLapTime(driver.Sector_1_Best, true), f, Sector1Brush, 245f,
                                             10f + ind * LineHeight);
                                g.DrawString(PrintLapTime(driver.Sector_2_Best, true), f, Sector2Brush, 295f,
                                             10f + ind * LineHeight);
                                g.DrawString(PrintLapTime(driver.Sector_3_Best, true), f, Sector3Brush, 345f,
                                             10f + ind * LineHeight);
                            }
                            else if (driver.Sector_1_Last > 0)
                            {
                                bool DisplayAllSectors = false;

                                if (!DisplayTimers.ContainsKey(driver.Name))
                                {
                                    DisplayTimers.Add(driver.Name, -1);
                                }
                                if (driver.TrackPosition == TrackPosition.SECTOR1)
                                {
                                    DisplayTimers[driver.Name]--;
                                }
                                if (driver.TrackPosition == TrackPosition.SECTOR2)
                                {
                                    DisplayTimers[driver.Name] = 10;
                                }
                                if (DisplayTimers[driver.Name] > 0 && driver.TrackPosition == TrackPosition.SECTOR1)
                                {
                                    DisplayAllSectors = true;
                                }
                                //if (data[driverIndex].CurrentSector >= 2 || data[driverIndex].CurrentSector == 0)
                                if (driver.TrackPosition == TrackPosition.SECTOR2 ||
                                    driver.TrackPosition == TrackPosition.SECTOR3 || DisplayAllSectors)
                                {
                                    Brush Sector1Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR2)
                                    {
                                        Sector1Brush = Brushes.White;
                                    }
                                    if (driver.Sector_1_Last == driver.LapTime_Best_Sector1)
                                    {
                                        Sector1Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_1_Last <= BestSector1)
                                    {
                                        Sector1Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_1_Last, true), f, Sector1Brush, 245f,
                                                 10f + ind * LineHeight);
                                }
                                if (driver.TrackPosition == TrackPosition.SECTOR3 || DisplayAllSectors)
                                //if (data[driverIndex].CurrentSector == 3 || data[driverIndex].CurrentSector == 0)
                                {
                                    Brush Sector2Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR3)
                                    {
                                        Sector2Brush = Brushes.White;
                                    }
                                    if (driver.Sector_2_Last == driver.LapTime_Best_Sector2)
                                    {
                                        Sector2Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_2_Last <= BestSector2)
                                    {
                                        Sector2Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_2_Last, true), f, Sector2Brush, 295f,
                                                 10f + ind * LineHeight);
                                }
                                if (DisplayAllSectors && driver.Sector_3_Last > 0)
                                //if (data[driverIndex].CurrentSector == 0)
                                {
                                    Brush Sector3Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR1)
                                    {
                                        Sector3Brush = Brushes.White;
                                    }
                                    if (driver.Sector_3_Last == driver.LapTime_Best_Sector3)
                                    {
                                        Sector3Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_3_Last <= BestSector3)
                                    {
                                        Sector3Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_3_Last, true), f, Sector3Brush, 345f,
                                                 10f + ind * LineHeight);
                                }
                                if (!driver.Pits && driver.Speed < 5)
                                {
                                    if (driver.TrackPosition == TrackPosition.SECTOR1)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 245f, 10f + ind * LineHeight);
                                    }
                                    if (driver.TrackPosition == TrackPosition.SECTOR2)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 295f, 10f + ind * LineHeight);
                                    }
                                    if (driver.TrackPosition == TrackPosition.SECTOR3)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 345f, 10f + ind * LineHeight);
                                    }
                                }
                            }
                            else if (driver.Laps > 0 || (driver.Laps == 0 && driver.Pits == false))
                            {
                                g.DrawString("OUT", f, Brushes.Red, 265f, 10f + ind * LineHeight);
                            }

                            g.DrawString(driver.Pitstops.ToString(), f, Brushes.White, 395f, 10f + ind * LineHeight);
                        }
                        else
                        {
                            /*if (driver.Retired && driver.Speed < 5)
                             * {
                             *  g.DrawString("[RETIRED]", f, Brushes.Red, 265f, 10f + ind * LineHeight);
                             *
                             * }
                             * else */
                            if (driver.Pits && driver.Sector_1_Best > 0)
                            {
                                if (driver.LapTime_Best < lapTimeBest && driver.LapTime_Best != -1f)
                                {
                                    lapTimeBest = driver.LapTime_Best;
                                }
                                if (driver.LapTime_Best != -1f)
                                {
                                    g.DrawString(PrintLapTime(driver.LapTime_Best, false), f, Brushes.Yellow, 140f,
                                                 10f + ind * LineHeight);
                                }
                                if (driver.LapTime_Best != lapTimeBest && driver.LapTime_Best != -1f)
                                {
                                    double diff = driver.LapTime_Best - lapTimeBest;
                                    g.DrawString(diff.ToString("0.000"), f, Brushes.Yellow, 195f, 10f + ind * LineHeight);
                                }

                                Brush Sector1Brush = Brushes.Yellow;
                                Brush Sector2Brush = Brushes.Yellow;
                                Brush Sector3Brush = Brushes.Yellow;
                                if (driver.Sector_1_Best <= BestSector1)
                                {
                                    Sector1Brush = Brushes.Magenta;
                                }
                                if (driver.Sector_2_Best <= BestSector2)
                                {
                                    Sector2Brush = Brushes.Magenta;
                                }
                                if (driver.Sector_3_Best <= BestSector3)
                                {
                                    Sector3Brush = Brushes.Magenta;
                                }
                                g.DrawString(PrintLapTime(driver.Sector_1_Best, true), f, Sector1Brush, 245f,
                                             10f + ind * LineHeight);
                                g.DrawString(PrintLapTime(driver.Sector_2_Best, true), f, Sector2Brush, 295f,
                                             10f + ind * LineHeight);
                                g.DrawString(PrintLapTime(driver.Sector_3_Best, true), f, Sector3Brush, 345f,
                                             10f + ind * LineHeight);
                            }
                            else
                            {
                                bool DisplayAllSectors = false;
                                if (!DisplayTimers.ContainsKey(driver.Name))
                                {
                                    DisplayTimers.Add(driver.Name, -1);
                                }
                                if (driver.TrackPosition == TrackPosition.SECTOR1)
                                {
                                    DisplayTimers[driver.Name]--;
                                }
                                if (driver.TrackPosition == TrackPosition.SECTOR2)
                                {
                                    DisplayTimers[driver.Name] = 10;
                                }
                                if (DisplayTimers[driver.Name] > 0 && driver.TrackPosition == TrackPosition.SECTOR1)
                                {
                                    DisplayAllSectors = true;
                                }
                                //if (data[driverIndex].CurrentSector >= 2 || data[driverIndex].CurrentSector == 0)

                                if ((LastPitLap[driver.Name] == driver.Laps || driver.Sector_1_Last < 0) && !driver.Pits)
                                {
                                    g.DrawString("OUT", f, Brushes.Red, 245f, 10f + ind * LineHeight);
                                }
                                else if (driver.TrackPosition == TrackPosition.SECTOR2 ||
                                         driver.TrackPosition == TrackPosition.SECTOR3 || DisplayAllSectors)
                                {
                                    Brush Sector1Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR2)
                                    {
                                        Sector1Brush = Brushes.White;
                                    }
                                    if (driver.Sector_1_Last == driver.LapTime_Best_Sector1)
                                    {
                                        Sector1Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_1_Last <= BestSector1)
                                    {
                                        Sector1Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_1_Last, true), f, Sector1Brush, 245f,
                                                 10f + ind * LineHeight);
                                }

                                if (driver.TrackPosition == TrackPosition.SECTOR3 || DisplayAllSectors)
                                //if (data[driverIndex].CurrentSector == 3 || data[driverIndex].CurrentSector == 0)
                                {
                                    Brush Sector2Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR3)
                                    {
                                        Sector2Brush = Brushes.White;
                                    }
                                    if (driver.Sector_2_Last == driver.LapTime_Best_Sector2)
                                    {
                                        Sector2Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_2_Last <= BestSector2)
                                    {
                                        Sector2Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_2_Last, true), f, Sector2Brush, 295f,
                                                 10f + ind * LineHeight);
                                }
                                if (DisplayAllSectors && driver.Sector_3_Last > 0)
                                //if (data[driverIndex].CurrentSector == 0)
                                {
                                    Brush Sector3Brush = Brushes.Yellow;
                                    if (driver.TrackPosition == TrackPosition.SECTOR1)
                                    {
                                        Sector3Brush = Brushes.White;
                                    }
                                    if (driver.Sector_3_Last == driver.LapTime_Best_Sector3)
                                    {
                                        Sector3Brush = Brushes.Green;
                                    }
                                    if (driver.Sector_3_Last <= BestSector3)
                                    {
                                        Sector3Brush = Brushes.Magenta;
                                    }
                                    g.DrawString(PrintLapTime(driver.Sector_3_Last, true), f, Sector3Brush, 345f,
                                                 10f + ind * LineHeight);



                                    if (driver.LapTime_Last < lapTimeBest && driver.LapTime_Last != -1f)
                                    {
                                        lapTimeBest = driver.LapTime_Best;
                                    }
                                    if (driver.LapTime_Last != -1f)
                                    {
                                        g.DrawString(PrintLapTime(driver.LapTime_Last, false), f, Brushes.White, 140f,
                                                     10f + ind * LineHeight);
                                    }
                                    if (driver.LapTime_Last != lapTimeBest && driver.LapTime_Last != -1f)
                                    {
                                        double diff = driver.LapTime_Last - lapTimeBest;
                                        g.DrawString(diff.ToString("0.000"), f, Brushes.White, 195f,
                                                     10f + ind * LineHeight);
                                    }
                                }
                                else
                                {
                                    if (driver.LapTime_Best < lapTimeBest && driver.LapTime_Best != -1f)
                                    {
                                        lapTimeBest = driver.LapTime_Best;
                                    }
                                    if (driver.LapTime_Best != -1f)
                                    {
                                        g.DrawString(PrintLapTime(driver.LapTime_Best, false), f, Brushes.Yellow, 140f,
                                                     10f + ind * LineHeight);
                                    }
                                    if (driver.LapTime_Best != lapTimeBest && driver.LapTime_Best != -1f)
                                    {
                                        double diff = driver.LapTime_Best - lapTimeBest;
                                        g.DrawString(diff.ToString("0.000"), f, Brushes.Yellow, 195f,
                                                     10f + ind * LineHeight);
                                    }
                                }
                                if (!driver.Pits && driver.Speed < 5)
                                {
                                    if (driver.TrackPosition == TrackPosition.SECTOR1)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 245f, 10f + ind * LineHeight);
                                    }
                                    if (driver.TrackPosition == TrackPosition.SECTOR2)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 295f, 10f + ind * LineHeight);
                                    }
                                    if (driver.TrackPosition == TrackPosition.SECTOR3)
                                    {
                                        g.DrawString("[STOP]", f, Brushes.Red, 345f, 10f + ind * LineHeight);
                                    }
                                }
                            }

                            g.DrawString(driver.Laps.ToString(), f, Brushes.White, 395f, 10f + ind * LineHeight);
                        }

                        ind++;
                    }

                    // Place fastest lap & combined lap
                    if (BestSector3Position != 0)
                    {
                        g.DrawString("Fastest lap: ", f, Brushes.DarkGray, 10f, 10f + ind * LineHeight);
                        g.DrawString(FastestDriver, f, Brushes.Yellow, 195f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(FastestLap, false), f, Brushes.Magenta, 140f, 10f + ind * LineHeight);



                        g.DrawString("P" + BestSector1Position, f, Brushes.Yellow, 275f, 10f + ind * LineHeight);
                        g.DrawString("P" + BestSector2Position, f, Brushes.Yellow, 325f, 10f + ind * LineHeight);
                        g.DrawString("P" + BestSector3Position, f, Brushes.Yellow, 375f, 10f + ind * LineHeight);
                    }
                    if (BestSector3 != 1000)
                    {
                        ind++;
                        g.DrawString("Combined lap: ", f, Brushes.DarkGray, 10f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(BestSector1 + BestSector2 + BestSector3, false), f, Brushes.Magenta,
                                     140f,
                                     10f + ind * LineHeight);

                        g.DrawString(PrintLapTime(BestSector1, true), f, Brushes.Magenta, 245f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(BestSector2, true), f, Brushes.Magenta, 295f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(BestSector3, true), f, Brushes.Magenta, 345f, 10f + ind * LineHeight);
                        ind++;
                        g.DrawString("Personal Combined lap: ", f, Brushes.DarkGray, 10f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(MyBestSector1 + MyBestSector2 + MyBestSector3, false), f,
                                     Brushes.Magenta, 140f,
                                     10f + ind * LineHeight);

                        g.DrawString(PrintLapTime(MyBestSector1, true), f, Brushes.Magenta, 245f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(MyBestSector2, true), f, Brushes.Magenta, 295f, 10f + ind * LineHeight);
                        g.DrawString(PrintLapTime(MyBestSector3, true), f, Brushes.Magenta, 345f, 10f + ind * LineHeight);
                    }
                }
            }
            catch (Exception ex)
            {
                /*
                 * g.FillRectangle(Brushes.Black, e.ClipRectangle);
                 * g.DrawString("ERROR", f, Brushes.Red, 10f, 10f);
                 * g.DrawString(ex.Message, f, Brushes.Yellow, 10f, 50f);
                 * string[] lines = ex.StackTrace.Split("\n".ToCharArray());
                 *
                 * int i = 1;
                 * foreach (string line in lines)
                 * {
                 *  i++;
                 *  g.DrawString(line, f, Brushes.White, 10f, 10f + i * 30f);
                 * }*/
            }
            base.OnPaint(e);
        }
Exemple #15
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            try
            {
                Graphics g = e.Graphics;
                g.FillRectangle(Brushes.Black, e.ClipRectangle);
                if (!Telemetry.m.Active_Session)
                {
                    return;
                }

                System.Drawing.Font f = new Font("Arial", 8, FontStyle.Regular);

                g.DrawString("Pos", f, Brushes.DarkGray, 10f, 10f);
                g.DrawString("Name", f, Brushes.DarkGray, 40f, 10f);
                g.DrawString("Gap", f, Brushes.DarkGray, 160f, 10f);
                g.DrawString("Best Lap", f, Brushes.DarkGray, 230f, 10f);
                g.DrawString("Last Lap", f, Brushes.DarkGray, 300f, 10f);
                g.DrawString("Pits", f, Brushes.DarkGray, 380f, 10f);

                List <IDriverGeneral> drivers = Telemetry.m.Sim.Drivers.AllDrivers;
                drivers.Sort(sortDriver);

                int   ind        = 1;
                float LineHeight = 16f;

                // Go through all drivers
                for (int p = Math.Max(0, Telemetry.m.Sim.Drivers.Player.Position - 6); p <= Telemetry.m.Sim.Drivers.Player.Position + 12; p++)
                {
                    if (ind == 16 || p >= drivers.Count)
                    {
                        break;
                    }
                    IDriverGeneral driver = drivers[p];

                    Brush OntrackBrush = ((!driver.Pits && driver.Speed > 5) ? Brushes.White : Brushes.Red);
                    if (Telemetry.m.Sim.Drivers.Player.Position == driver.Position)
                    {
                        OntrackBrush = Brushes.Yellow;
                    }
                    g.DrawString(driver.Position.ToString(), f, Brushes.White, 10f, 10f + ind * LineHeight);
                    string[] name = driver.Name.ToUpper().Split(" ".ToCharArray());
                    if (name.Length == 1)
                    {
                        g.DrawString(name[0], f, OntrackBrush, 38f, 10f + ind * LineHeight);
                    }
                    else if (name.Length > 1)
                    {
                        g.DrawString(name[0].Substring(0, 1) + ". " + name[name.Length - 1], f, OntrackBrush, 38f,
                                     10f + ind * LineHeight);
                    }

                    if (!driver.Pits && driver.Speed < 5)
                    {
                        g.DrawString("[STOP]", f, Brushes.Red, 345f, 10f + ind * LineHeight);
                    }
                    if (driver.Pits)
                    {
                        g.DrawString("[PITS]", f, Brushes.Red, 345f, 10f + ind * LineHeight);
                    }

                    double split_leader = driver.GetSplitTime(drivers[0]);
                    if (split_leader >= 0 && split_leader < 10000)
                    {
                        g.DrawString(Math.Round(split_leader, 1).ToString(), f, Brushes.White, 160f, 10f + ind * LineHeight);
                    }
                    else if (split_leader >= 10000)
                    {
                        int laps = Convert.ToInt32(split_leader / 10000);
                        g.DrawString("+" + laps + "L", f, Brushes.Yellow, 160f, 10f + ind * LineHeight);
                    }
                    else if (drivers[0].Position == driver.Position)
                    {
                        g.DrawString("LAP " + drivers[0].Laps, f, Brushes.Yellow, 160f, 10f + ind * LineHeight);
                    }

                    /*if (driver.Position > 3)
                     * {
                     *  DriverGeneral drv = driver;
                     *  foreach(DriverGeneral drv_ in drivers)
                     *  {
                     *      if (drv_.Position == driver.Position - 1 && drv_.__LapsData.ToInt32() > 0)
                     *          drv = drv_;
                     *  }
                     *  if (drv != null)
                     *  {
                     *      double split_next = driver.GetSplitTime(drv);
                     *      if (split_next < 10000)
                     *          g.DrawString(Math.Round(split_next, 1).ToString(), f,
                     *                       Brushes.White, 190f, 10f + ind*LineHeight);
                     *      else
                     *      {
                     *          int laps = Convert.ToInt32(split_next/10000);
                     *          g.DrawString("+" + laps + "L", f, Brushes.Yellow, 190f, 10f + ind*LineHeight);
                     *      }
                     *  }
                     * }*/

                    g.DrawString(PrintLapTime(driver.LapTime_Best, false), f, Brushes.Yellow, 230f, 10f + ind * LineHeight);
                    if (driver.LapTime_Best == driver.LapTime_Last)
                    {
                        g.DrawString(PrintLapTime(driver.LapTime_Last, false), f, Brushes.Green, 300f, 10f + ind * LineHeight);
                    }
                    else
                    {
                        g.DrawString(PrintLapTime(driver.LapTime_Last, false), f, Brushes.Yellow, 300f, 10f + ind * LineHeight);
                    }

                    g.DrawString(driver.Pitstops.ToString(), f, Brushes.White, 380f, 10f + ind * LineHeight);


                    ind++;
                }

                Font sf = new Font("Arial", 8f);

                g.DrawString("Engine", sf, DimBrush, this.Width - 42, this.Height - 60);
                g.DrawString("Tyres", sf, DimBrush, this.Width - 35, this.Height - 45);
                g.DrawString("Laptimes", sf, DimBrush, this.Width - 51, this.Height - 30);
                g.DrawString("Split", sf, Brushes.White, this.Width - 30, this.Height - 15);
            }
            catch (Exception ex)
            {
                Graphics g = e.Graphics;
                g.FillRectangle(Brushes.Black, e.ClipRectangle);

                System.Drawing.Font f = new Font("Arial", 8f);

                g.DrawString(ex.Message, f, Brushes.White, 10, 10);
                g.DrawString(ex.StackTrace.Replace("in ", "\r\n"), f, Brushes.White, 10, 30);
            }
        }
Exemple #16
0
        public double GetSplitTime(IDriverGeneral player)
        {
            return(0);

            throw new NotImplementedException();
        }
 public double GetSplitTime(IDriverGeneral player)
 {
     return 0;
 }
        public static IDriverGeneral Create(IDriverGeneral player)
        {
            NetworkDriverGeneral nwGeneral = new NetworkDriverGeneral();

            // TODO: Make a object copy machine.
            nwGeneral.Driving = player.Driving;
            nwGeneral.Ignition = player.Ignition;
            nwGeneral.MemoryBlock = player.MemoryBlock;
            nwGeneral.SectorsDriven = player.SectorsDriven;
            nwGeneral.Active = player.Active;
            nwGeneral.IsPlayer = player.IsPlayer;
            nwGeneral.Name = player.Name;
            nwGeneral.BaseAddress = player.BaseAddress;
            nwGeneral.CoordinateX = player.CoordinateX;
            nwGeneral.CoordinateY = player.CoordinateY;
            nwGeneral.CoordinateZ = player.CoordinateZ;
            nwGeneral.Throttle = player.Throttle;
            nwGeneral.Brake = player.Brake;
            nwGeneral.Fuel = player.Fuel;
            nwGeneral.Fuel_Max = player.Fuel_Max;
            nwGeneral.CarModel = player.CarModel;
            nwGeneral.CarClass = player.CarClass;
            nwGeneral.Control_AI_Aid = player.Control_AI_Aid;
            nwGeneral.PitLimiter = player.PitLimiter;
            nwGeneral.Pits = player.Pits;
            nwGeneral.HeadLights = player.HeadLights;
            nwGeneral.Laps = player.Laps;
            nwGeneral.LapTime_Best = player.LapTime_Best;
            nwGeneral.LapTime_Last = player.LapTime_Last;
            nwGeneral.LapTime_Best_Sector1 = player.LapTime_Best_Sector1;
            nwGeneral.LapTime_Best_Sector2 = player.LapTime_Best_Sector2;
            nwGeneral.LapTime_Best_Sector3 = player.LapTime_Best_Sector3;
            nwGeneral.Sector_1_Best = player.Sector_1_Best;
            nwGeneral.Sector_2_Best = player.Sector_2_Best;
            nwGeneral.Sector_3_Best = player.Sector_3_Best;
            nwGeneral.Sector_1_Last = player.Sector_1_Last;
            nwGeneral.Sector_2_Last = player.Sector_2_Last;
            nwGeneral.Sector_3_Last = player.Sector_3_Last;
            nwGeneral.MetersDriven = player.MetersDriven;
            nwGeneral.PitStopRuns = player.PitStopRuns;
            nwGeneral.Retired = player.Retired;
            nwGeneral.TrackPosition = player.TrackPosition;
            nwGeneral.SteeringHelp = player.SteeringHelp;
            nwGeneral.PitStop_FrontWingSetting = player.PitStop_FrontWingSetting;
            nwGeneral.PitStop_RearWingSetting = player.PitStop_RearWingSetting;
            nwGeneral.PitStop_FuelSetting = player.PitStop_FuelSetting;
            nwGeneral.FuelSetting_Offset = player.FuelSetting_Offset;
            nwGeneral.FuelSetting_Scale = player.FuelSetting_Scale;
            nwGeneral.MassEmpty = player.MassEmpty;
            nwGeneral.Mass = player.Mass;
            nwGeneral.RPM_Stationary = player.RPM_Stationary;
            nwGeneral.RPM_Max_Offset = player.RPM_Max_Offset;
            nwGeneral.RPM_Max_Scale = player.RPM_Max_Scale;
            nwGeneral.Speed = player.Speed;
            nwGeneral.RPM = player.RPM;
            nwGeneral.Position = player.Position;
            nwGeneral.Gear = player.Gear;
            nwGeneral.Gears = player.Gears;
            nwGeneral.GearRatio1 = player.GearRatio1;
            nwGeneral.GearRatio2 = player.GearRatio2;
            nwGeneral.GearRatio3 = player.GearRatio3;
            nwGeneral.GearRatio4 = player.GearRatio4;
            nwGeneral.GearRatio5 = player.GearRatio5;
            nwGeneral.GearRatio6 = player.GearRatio6;
            nwGeneral.GearRatio7 = player.GearRatio7;
            nwGeneral.GearRatio8 = player.GearRatio8;
            nwGeneral.GearRatio9 = player.GearRatio9;
            nwGeneral.GearRatio10 = player.GearRatio10;
            nwGeneral.GearRatio11 = player.GearRatio11;
            nwGeneral.GearRatio12 = player.GearRatio12;
            nwGeneral.GearRatio13 = player.GearRatio13;
            nwGeneral.GearRatio14 = player.GearRatio14;
            nwGeneral.GearRatio15 = player.GearRatio15;
            nwGeneral.GearRatio16 = player.GearRatio16;
            nwGeneral.GearRatio17 = player.GearRatio17;
            nwGeneral.GearRatio18 = player.GearRatio18;
            nwGeneral.GearRatioR = player.GearRatioR;
            nwGeneral.TyreWear_LF = player.TyreWear_LF;
            nwGeneral.TyreWear_RF = player.TyreWear_RF;
            nwGeneral.TyreWear_LR = player.TyreWear_LR;
            nwGeneral.TyreWear_RR = player.TyreWear_RR;
            nwGeneral.Flag_Blue = player.Flag_Blue;
            nwGeneral.Flag_Yellow = player.Flag_Yellow;
            nwGeneral.Flag_Black = player.Flag_Black;
            return nwGeneral;
        }