diff --git a/C/src/xplaneConnect.c b/C/src/xplaneConnect.c index 24d9c1c..004d4e1 100755 --- a/C/src/xplaneConnect.c +++ b/C/src/xplaneConnect.c @@ -542,53 +542,64 @@ int sendPOSI(XPCSocket sock, float values[], int size, char ac) /**** End POSI functions ****/ /*****************************************************************************/ -short sendCTRL(XPCSocket recfd, short numArgs, float valueArray[]) +/*****************************************************************************/ +/**** CTRL functions ****/ +/*****************************************************************************/ +int psendCTRL(XPCSocket sock, float values[], int size) { - return sendpCTRL(recfd, numArgs, valueArray, 0); + return sendCTRL(sock, values, size, 0); } -short sendpCTRL(XPCSocket recfd, short numArgs, float valueArray[], char acNum) +int sendCTRL(XPCSocket sock, float values[], int size, char ac) { - char message[27] = { 0 }; - int i; - short position = 5; - - // Input Verification - if (numArgs < 1) + // Validate input + if (ac < 0 || ac > 20) { - return errorReport("CTRL", "Must have atleast one argument"); + printError("sendCTRL", "aircraft should be a value between 0 and 20."); + return -1; } - - // Header - strncpy(message,"CTRL",4); - - // States - for (i=0;i<6;i++) + if (size < 1 || size > 7) { - float val = -998.5; - - if (i