The SimConnect_AIReleaseControl function is used to clear the AI control of a simulated object, typically an aircraft, in order for it to be controlled by a SimConnect client.

 

Syntax
HRESULT SimConnect_AIReleaseControl(
    HANDLE  hSimConnect,
    SIMCONNECT_OBJECT_ID  ObjectID,
    SIMCONNECT_DATA_REQUEST_ID  RequestID
    );

 

Parameters
ParameterDescriptionType
hSimConnectHandle to a SimConnect object.Integer
ObjectIDSpecifies the server defined object ID.Integer
RequestIDSpecifies the client defined request ID.Integer

 

Return Values

The function returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return valueDescription
S_OKThe function succeeded.
E_FAILThe function failed.

 

Remarks

This function should be used to transfer the control of an aircraft, or other object, from the AI system to the SimConnect client. If this is not done the AI system and client may fight each other with unpredictable results. To prevent the simulation engine from updating the latitude, longitude, altitude and attitude of an aircraft, refer to the range of FREEZE_* Event IDs.

 

The object ID can be obtained in a number of ways, refer to the SimConnect_RequestDataOnSimObjectType call, and also the use of the SIMCONNECT_RECV_ASSIGNED_OBJECT_ID structure.