/// <summary> /// Creates an IS_HCP packet and sets the various car handicaps. /// </summary> /// <param name="cars">The cars to set the handicap for.</param> /// <param name="H_Mass">The added mass to set in kilograms (0 - 200).</param> /// <param name="H_TRes">The intake restriction to set (0 - 50).</param> /// <returns>An IS_HCP packet.</returns> public static IS_HCP SetHandicap(CarFlags cars, byte H_Mass = 0, byte H_TRes = 0) { var packet = new IS_HCP(); SetHandicap(packet, cars, H_Mass, H_TRes); return(packet); }
/// <summary> /// Sets the handicap for the specified cars. /// </summary> /// <param name="packet">The <see cref="IS_HCP"/> packet containing the handicaps.</param> /// <param name="cars">The cars to set the handicap for.</param> /// <param name="H_Mass">The added mass to set in kilograms (0 - 200).</param> /// <param name="H_TRes">The intake restriction to set (0 - 50).</param> public static void SetHandicap(IS_HCP packet, CarFlags cars, byte H_Mass = 0, byte H_TRes = 0) { foreach (KeyValuePair <CarFlags, byte> map in CarMap) { if (cars.HasFlag(CarFlags.All) || cars.HasFlag(map.Key)) { packet.Info[map.Value].H_Mass = H_Mass; packet.Info[map.Value].H_TRes = H_TRes; } } }