DragonflightDesign
Resource contributor
- Messages
- 1,164
- Country
Well, I never thought I'd be so relieved to see fuel being pumped overboard. Ignoring my code foul-ups along the way, the base of the problem was (to quote Doug) 'the infrequent updates on the fuel vars '. Getting the fuel quantities and capacities into SimConnect made things so much easier. I also elected to go Maryadi's and Doug's suggested ways of reading and writing to single tanks rather than doing all tanks together in a struct. It made debugging slightly easier at the expense of increasing the code count. Many thanks to all for the contributions because I ended up using bits from all of you.
I did find something a bit strange along the way. 'FlightLoaded' really does not like being the first entry in any enumeration. I absolutely could not get the name of the flight through either
or
Yet the moment I moved REQUEST_FLIGHT_LOADED and EVENT_FLIGHT_LOADED to the second line (ID=1) in their respected enumerations, both started working!
Once I'm sure about my flow rate calculations I'll package it up as a resource.
I did find something a bit strange along the way. 'FlightLoaded' really does not like being the first entry in any enumeration. I absolutely could not get the name of the flight through either
Code:
case CLIENT_SIMSTART:
{
// Flight just loaded
hr = SimConnect_RequestSystemState(hSimConnect, REQUEST_FLIGHT_LOADED, "FlightLoaded");
}
(...)
void OnRecvSystemState(SIMCONNECT_RECV_SYSTEM_STATE *pData)
{
if (pData->dwRequestID)
{
switch (pData->dwRequestID)
{
case REQUEST_FLIGHT_LOADED:
strncpy_s(CURRENT_FLIGHT, MAX_PATH, pData->szString, sizeof(pData->szString));
break;
Code:
hr = SimConnect_SubscribeToSystemEvent(hSimConnect, EVENT_FLIGHT_LOADED, "FlightLoaded");
(...)
void OnRecvEventFilename(SIMCONNECT_RECV_EVENT_FILENAME *pData, DWORD cbData)
{
switch (pData->uEventID)
{
// Name of the flight just loaded
case EVENT_FLIGHT_LOADED:
strncpy_s(CURRENT_FLIGHT, MAX_PATH, pData->szFileName, sizeof(pData->szFileName));
break;
Once I'm sure about my flow rate calculations I'll package it up as a resource.
Last edited: