Einzelnen Beitrag anzeigen

SimStar001

Registriert seit: 18. Jan 2008
594 Beiträge
 
#5

Re: Variablentypen?

  Alt 17. Aug 2009, 17:53
s ich habe nochmal ne erklärung gefunden...

Zitat:
Longitude of aircraft in FS format.

To convert to Degrees:

If your compiler supports long long (64-bit) integers then use such a variable to simply copy this 64-bit value into a double floating point variable and multiply by 360.0/(65536.0 * 65536.0 * 65536.0 * 65536.0).

Otherwise you will have to handle the high 32-bits and the low 32-bits separately, combining them into one double floating point value (say dHi). To do, copy the high part (the 32-bit int at 056C) to one double and the low part (the 32-bit unsigned int at 0568) to another (say dLo). Remember that the low part is only part of a bigger number, so doesn’t have a sign of its own. Divide dLo by (65536.0 * 65536.0) to give it its proper magnitude compared to the high part, then either add it to or subtract it from dHi according to whether dHi is positive or negative. This preserves the integrity of the original positive or negative number. Finally multiply the result by 360.0/(65536.0 * 65536.0) to get degrees.

Either way, a negative result is West, positive East. If you did it all unsigned then values over 180.0 represent West longitudes of (360.0 – the value).

[Can be written to move aircraft: in FS2002 only in slew or pause states]

Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var dwresult : dword;
    Longitude : int64;
    wert : int64;
    Latitude : int64;
    lat : extended;
    temp : string;
begin
  FSUIPC_Open(SIM_ANY, dwResult) ;
  if FSUIPC_Read($0568, 3, @wert, dwResult) then
  if FSUIPC_Process(dwResult) then
    begin
    wert := wert * 360;
    showmessage(floattostr( (wert/ 65536 / 65536 / 65536 /65536)));
    end;
end;
  Mit Zitat antworten Zitat