Jump to content
The simFlight Network Forums

Calculating total fuel quantity (FS9 and FSX, C++)


Recommended Posts

Hello,

I recently realized that I was using an FSX only value to calculate fuel in my ACARS, which obviously was creating issues with FS9 users. I've adjusted the code to use FS9 capable variables, and calculate the fuel by subtracting the zero fuel weight from the total weight.

I'm fairly confident that my code is correct, seeing as though it does indeed record the appropriate value in FSX, however, is still doesn't record from FS9. Is there something else I'm missing?

The relevant code is below:


DWORD result;
FSUIPC_Open(SIM_ANY, &result) //I'm using this as my connection open code

//The actual code does indeed have more error checking than this, I just chose to copy it this way for simplicity.
int ZFW;
long long TWEIGHT;
unsigned long result;

FSUIPC_Read(0x3BFC,4,&ZFW,&result);
FSUIPC_Read(0x30C0,8,&TWEIGHT,&result);

double zero_fw = ZFW / 256;
double fuel_w = TWEIGHT - zero_fw;
p.fuelquantity = (int)fuel_w;
[/CODE]

I appreciate any assistance in advance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.