22using System . Collections . Generic ;
33using System . Linq ;
44using System . Runtime . InteropServices ;
5+ using FSTRaK . Models ;
56
67namespace FSTRaK . DataTypes
78{
@@ -19,12 +20,12 @@ public enum CameraState
1920 GamePlay = 8 ,
2021 Showcase = 9 ,
2122 DroneAircraft = 10 ,
22- Waiting = 11 ,
23+ Waiting = 11 , // Loading flight
2324 WorldMap = 12 ,
2425 HangarRtc = 13 ,
2526 HangarCustom = 14 ,
26- MenuRtc = 15 ,
27- InGameRtc = 16 ,
27+ MenuRtc = 15 , // Main menu
28+ InGameRtc = 16 , // "Ready to fly"
2829 Replay = 17 ,
2930 DroneTopDown = 19 ,
3031 Hangar = 21 ,
@@ -60,14 +61,15 @@ public enum Requests
6061 {
6162 FlightDataRequest ,
6263 NearbyAirportsRequest ,
63- FlightLoaded
64+ FlightLoaded ,
65+ AircraftLoaded ,
66+ AircraftDataRequest
6467 }
6568
6669 public enum DataDefinitions
6770 {
68- FlightMetaData ,
71+ AircraftData ,
6972 FlightData ,
70- NearbyAirports
7173 }
7274
7375 public enum Events
@@ -79,12 +81,8 @@ public enum Events
7981 }
8082
8183 [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Ansi , Pack = 1 ) ]
82- public struct AircraftFlightData
84+ public struct AircraftData
8385 {
84- public int zuluYear ;
85- public int zuluMonth ;
86- public int zuluDay ;
87- public int zuluTime ;
8886 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 256 ) ]
8987 public string title ;
9088 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 256 ) ]
@@ -95,27 +93,37 @@ public struct AircraftFlightData
9593 public string atcType ;
9694 [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 32 ) ]
9795 public string AtcId ;
96+ [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 128 ) ]
97+ public string Category ;
9898
9999 public EngineType EngineType ;
100100 public int NumberOfEngines ;
101+ }
101102
103+ [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Ansi , Pack = 1 ) ]
104+ public struct FlightData
105+ {
106+ public int zuluYear ;
107+ public int zuluMonth ;
108+ public int zuluDay ;
109+ public int zuluTime ;
102110
103111 public int SimOnGround ;
104112 public double Latitude ;
105113 public double Longitude ;
106114 public double TrueHeading ;
107115 public double Altitude ;
108116 public double TrueAirspeed ;
109- public double IndicatedAirpeed ;
117+ public double IndicatedAirspeed ;
110118 public double GroundVelocity ;
111119 public double GroundAltitude ;
112120 public double PlaneAltAboveGround ;
113121 public double PlaneAltAboveGroundMinusCg ;
114122 public double VerticalSpeed ;
115- public int CameraState ;
123+ public CameraState CameraState ;
116124 public int FlapSpeedExceeded ;
117125 public int GearSpeedExceeded ;
118- public int Overspeed ;
126+ public int OverSpeed ;
119127 public int StallWarning ;
120128 public double FlapPosition ;
121129 public double FuelWeightLbs ;
@@ -145,12 +153,12 @@ public double MaxThorttlePosition()
145153 return new double [ ] { Throttle1Position , Throttle2Position , Throttle3Position , Throttle3Position } . Max ( ) ;
146154 }
147155
148- public double MinThrottlePosition ( )
156+ public double MinThrottlePosition ( int numberOfEngines )
149157 {
150158 var thorttlePositionArray = new List < double > ( new double [ ] { Throttle1Position , Throttle1Position , Throttle2Position , Throttle3Position } ) ;
151- if ( NumberOfEngines == 0 )
159+ if ( numberOfEngines == 0 )
152160 return 0 ;
153- return thorttlePositionArray . GetRange ( 0 , NumberOfEngines ) . Min ( ) ;
161+ return thorttlePositionArray . GetRange ( 0 , numberOfEngines ) . Min ( ) ;
154162 }
155163
156164 }
0 commit comments