Added support for setting speed brakes to C client.

This commit is contained in:
Jason Watkins
2015-05-05 09:04:09 -07:00
parent 3030f67a9d
commit c6f9669e36
3 changed files with 98 additions and 5 deletions

View File

@@ -560,13 +560,13 @@ int sendCTRL(XPCSocket sock, float values[], int size, char ac)
}
if (size < 1 || size > 7)
{
printError("sendCTRL", "size should be a value between 1 and 6.");
printError("sendCTRL", "size should be a value between 1 and 7.");
return -2;
}
// Setup Command
// 5 byte header + 5 float values * 4 + 2 byte values
unsigned char buffer[27] = "CTRL";
unsigned char buffer[31] = "CTRL";
int cur = 5;
for (int i = 0; i < 6; i++)
{
@@ -587,9 +587,10 @@ int sendCTRL(XPCSocket sock, float values[], int size, char ac)
}
}
buffer[26] = ac;
*((float*)(buffer + 27)) = size == 7 ? values[6]: -998;
// Send Command
if (sendUDP(sock, buffer, 27) < 0)
if (sendUDP(sock, buffer, 31) < 0)
{
printError("sendCTRL", "Failed to send command");
return -3;

View File

@@ -182,8 +182,8 @@ int sendPOSI(XPCSocket sock, float values[], int size, char ac);
///
/// \param sock The socket to use to send the command.
/// \param values An array representing position data about the aircraft. The format of values is
/// [Elevator, Aileron, Rudder, Throttle, Gear, Flaps]. If less than 6 values are
/// specified, the unspecified values will be left unchanged.
/// [Elevator, Aileron, Rudder, Throttle, Gear, Flaps, Speed Brakes]. If less than
/// 6 values are specified, the unspecified values will be left unchanged.
/// \param size The number of elements in values.
/// \param ac The aircraft number to set the control surfaces of. 0 for the player aircraft.
/// \returns 0 if successful, otherwise a negative value.