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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.