-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd0084
commit b41ba4c
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
| ||
namespace InSimDotNet.Packets { | ||
/// <summary> | ||
/// Car handicaps - there is an array of these in IS_HCP. | ||
/// </summary> | ||
public struct CarHCP { | ||
/// <summary> | ||
/// Added mass (0kg to 200kg) | ||
/// </summary> | ||
public byte H_Mass { get; set; } | ||
|
||
/// <summary> | ||
/// Intake restriction (0 to 50) | ||
/// </summary> | ||
public byte H_TRes { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the packet data. | ||
/// </summary> | ||
/// <returns>An array containing the packet data.</returns> | ||
public void GetBuffer(PacketWriter writer) { | ||
writer.Write(H_Mass); | ||
writer.Write(H_TRes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
| ||
namespace InSimDotNet.Packets { | ||
/// <summary> | ||
/// HandiCaPs | ||
/// </summary> | ||
public class IS_HCP : IPacket, ISendable { | ||
private const int NumCars = 32; | ||
|
||
/// <summary> | ||
/// Gets the packet size. | ||
/// </summary> | ||
public byte Size { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the packet type. | ||
/// </summary> | ||
public PacketType Type { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the request ID. | ||
/// </summary> | ||
public byte ReqI { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the handicap info for each car in order (XF GTI first, XR GT second etc..). | ||
/// </summary> | ||
public CarHCP[] Info { get; private set; } | ||
|
||
/// <summary> | ||
/// Creates a new IS_HCP packet. | ||
/// </summary> | ||
public IS_HCP() { | ||
Size = 68; | ||
Type = PacketType.ISP_HCP; | ||
Info = new CarHCP[NumCars]; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the packet buffer. | ||
/// </summary> | ||
/// <returns>An array containing the packet data.</returns> | ||
public byte[] GetBuffer() { | ||
PacketWriter writer = new PacketWriter(Size); | ||
writer.Write(Size); | ||
writer.Write((byte)Type); | ||
writer.Write(ReqI); | ||
writer.Skip(1); | ||
|
||
foreach (CarHCP info in Info) { | ||
info.GetBuffer(writer); | ||
} | ||
|
||
return writer.GetBuffer(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters