I was looking things up and stumbled upon this old thread, which probably confused me, with regards to the 12-byte length.
http://forum.simflight.com/topic/9716-ai-offsets-2900%E2%80%93200b/
But I stand corrected.
I wouldn't say I'm new to programming, but the only programs I've written are for my own use and for parsing/dealing with large amounts of data only really using the standard c++/java libraries/functions/methods. I'm quite proficient when it comes to things I already understand but learning new stuff is challenging, as you probably have already noticed ;) And I didn't start with something simpler because I couldn't find anyone interested in writing this for me; I'm trying to write a program that takes in a "focus" ICAO and then deletes all AI traffic that isn't going to or leaving that airport, to maintain 100% traffic density at the focus airport and save FPS in really busy areas by removing "irrelevant" AI. I've been able to grab all the AI details with simconnect, and then this is the code I have once I've decided that a particular AI aircraft is irrelevant and needs to go:
DWORD FsuipcResult;
if (FSUIPC_Open(SIM_FSX,&FsuipcResult))
{
cout << "\nFSUIPC connected to Flight Simulator!";
}
else
{
cout << "\nFSUIPC NOT connected to Flight Simulator!";
}
printf("\nObjectID=%d registration=\"%s\ from=\"%s\ to=\"%s\"", ObjectID, pS->registration, pS->from, pS->to);
//delete aircraft
DWORD writeResult;
DWORD dwCmd[3];
dwCmd[0]=ObjectID;
dwCmd[1]=0xFFFF;
dwCmd[2]=0;
if(FSUIPC_Write(0x2900, 12, (BYTE*) dwCmd, &writeResult))
{
cout << "\nWrite succesful";
}
else
{
cout << "\nWrite unsuccesful";
}
if(FSUIPC_Process(&writeResult))
{
cout << "\nProcess succesful";
}
else
{
cout << "\nProcess unsuccessful";
}
FSUIPC_Close();
The program is picking out the right traffic to delete- the line where I print out ID/tail#/from/to fires for each target aircraft is working correctly and fires for each of the "bad" aircraft I see in the traffic toolbox. I get the FSUIPC is connected message for each of these aircraft (its probably unnecessary opening/closing over and over, but early on can't hurt until I confirm things are working), and the &FsuipcResult DWORD is 0, so FSUIPC is connecting OK each time. Then, I get the "write successful" and "process successful" messages each time, and the writeResult DWORD is 0 as well, so the command is being written and processed correctly for each aircraft. The only problem is that nothing happens in the sim- in the traffic toolbox explorer, each of the target AI aircraft that I know the program is correctly identifying keeps on going as if nothing happened, which seems likely, so one of the inputs is wrong somewhere.
Maybe the ID's that I have are wrong or in the wrong format? In the traffic explorer, the container ID's are listed as hex values, whereas DWORD is an unsigned int, correct? Is there a hex conversion I need to perform to pass in as the input ID?
thanks again for the help