diff --git a/InSimDotNet/Helpers/HandicapHelper.cs b/InSimDotNet/Helpers/HandicapHelper.cs
new file mode 100644
index 0000000..bbb4949
--- /dev/null
+++ b/InSimDotNet/Helpers/HandicapHelper.cs
@@ -0,0 +1,47 @@
+using InSimDotNet.Packets;
+using System.Collections.Generic;
+
+namespace InSimDotNet.Helpers {
+ ///
+ /// Helper class for setting car handicaps.
+ ///
+ public static class HandicapHelper {
+ private static Dictionary CarMap = new Dictionary() {
+ { CarFlags.XFG, 0 },
+ { CarFlags.XRG, 1 },
+ { CarFlags.XRT, 2 },
+ { CarFlags.RB4, 3 },
+ { CarFlags.FXO, 4 },
+ { CarFlags.LX4, 5 },
+ { CarFlags.LX6, 6 },
+ { CarFlags.MRT, 7 },
+ { CarFlags.UF1, 8 },
+ { CarFlags.RAC, 9 },
+ { CarFlags.FZ5, 10 },
+ { CarFlags.FOX, 11 },
+ { CarFlags.XFR, 12 },
+ { CarFlags.UFR, 13 },
+ { CarFlags.FO8, 14 },
+ { CarFlags.FXR, 15 },
+ { CarFlags.XRR, 16 },
+ { CarFlags.FZR, 17 },
+ { CarFlags.BF1, 18 },
+ { CarFlags.FBM, 19 },
+ };
+
+ ///
+ /// Sets the handicap for the specified cars.
+ ///
+ /// The packet containing the handicaps.
+ /// The added mass to set in kilograms (0 - 200).
+ /// The intake restriction to set (0 - 50).
+ public static void SetHandicap(IS_HCP packet, CarFlags cars, byte H_Mass = 0, byte H_TRes = 0) {
+ foreach (var car in CarMap) {
+ if (cars.HasFlag(car.Key) || cars.HasFlag(CarFlags.All)) {
+ packet.Info[car.Value].H_Mass = H_Mass;
+ packet.Info[car.Value].H_TRes = H_TRes;
+ }
+ }
+ }
+ }
+}
diff --git a/InSimDotNet/InSimDotNet.csproj b/InSimDotNet/InSimDotNet.csproj
index e330f4a..ad55405 100644
--- a/InSimDotNet/InSimDotNet.csproj
+++ b/InSimDotNet/InSimDotNet.csproj
@@ -60,6 +60,7 @@
+
diff --git a/version.txt b/version.txt
index 51908cc..09b94ac 100644
--- a/version.txt
+++ b/version.txt
@@ -1,8 +1,8 @@
- 2.1.1 (26th September 2014)
+* Added new IS_HCP packet and HandicapHelper class.
* Added ContinueOnCapturedContext property to InSim, TcpSocket and UdpSocket. Setting this to false prevents InSim.NET from marshalling packet callbacks back onto the calling thread e.g. in UI programs.
-* Fixed exploit that allowed players to crash InSim.NET by typing characters in LFS that were not translatable into unicode.
-* Fixed bug where sending certain multibyte characters could cause a crash.
+* Fixed bug that allowed players to crash InSim.NET by typing characters in LFS that were not translatable into unicode.
* TcpSocket and UdpSocket now expose their underlying .NET Socket objects for convienence.
- 2.1.0 (19th August 2014)