Hi All,
I've come across this MSDN article about monitoring AI objects (in particular AI aircraft) however as has been mentioned elsewhere on this forum, the sample code is no longer accessible. If anyone does have a copy and would be willing to share it would be VERY much appreciated!
Since I don't have it, I've had to hack my own code (i'm a very new developer so please excuse any mistakes).
I've made a call to the SimConnect_RequestDataOnSimObjectType to get a list of AI aircraft:
I'm subscribed to receive the reply:
And I do receive the reply as I see the Aircraft ID written to the console, but I have no idea what kind of data structure to receive this list of aircraft in
All I know is once I have the list of AI aircraft I need to call something like this to start receiving the data...
I've come across this MSDN article about monitoring AI objects (in particular AI aircraft) however as has been mentioned elsewhere on this forum, the sample code is no longer accessible. If anyone does have a copy and would be willing to share it would be VERY much appreciated!
Since I don't have it, I've had to hack my own code (i'm a very new developer so please excuse any mistakes).
I've made a call to the SimConnect_RequestDataOnSimObjectType to get a list of AI aircraft:
Code:
// Get a list of AI objects to monitor
simconnect.RequestDataOnSimObjectType(DATA_REQUESTS.REQUEST_AI_OBJECT_ID_BYTYPE, DEFINITIONS.AI_AIRCRAFT_DATA, MAXIMUM_RADIUS, SIMCONNECT_SIMOBJECT_TYPE.AIRCRAFT);
Code:
simconnect.OnRecvSimobjectDataBytype += new SimConnect.RecvSimobjectDataBytypeEventHandler(simconnect_OnRecvSimobjectData);
Code:
void simconnect_OnRecvSimobjectData(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA data)
{
switch ((DATA_REQUESTS)data.dwRequestID)
{
case DATA_REQUESTS.REQUEST_AI_OBJECT_ID_BYTYPE:
Write.Console("Aircraft ID: " + data.dwObjectID)
DO SOMETHING HERE!!!
break;
default:
displayText("Unknown request ID: " + data.dwRequestID);
break;
}
}
Code:
simconnect.RequestDataOnSimObject(DATA_REQUESTS.REQUEST_AI_AIRCRAFT_DATA, DEFINITIONS.AI_AIRCRAFT_DATA, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, 0, 0, 0);



