@@ -95,6 +95,8 @@ enum dataRefsXP {
95
95
DR_LOCAL_DATE_DAYS,
96
96
DR_USE_SYSTEM_TIME,
97
97
DR_ZULU_TIME_SEC,
98
+ DR_VIEW_EXTERNAL,
99
+ DR_VR_ENABLED,
98
100
CNT_DATAREFS_XP // always last, number of elements
99
101
};
100
102
@@ -127,7 +129,9 @@ enum dataRefsLT {
127
129
DR_SIM_TIME,
128
130
DR_CFG_AIRCRAFTS_DISPLAYED,
129
131
DR_CFG_AUTO_START,
132
+ DR_CFG_AI_FOR_TCAS,
130
133
DR_CFG_LABELS,
134
+ DR_CFG_LABEL_SHOWN,
131
135
DR_CFG_LABEL_COL_DYN,
132
136
DR_CFG_LABEL_COLOR,
133
137
DR_CFG_LOG_LEVEL,
@@ -139,6 +143,7 @@ enum dataRefsLT {
139
143
DR_CFG_FD_REFRESH_INTVL,
140
144
DR_CFG_FD_BUF_PERIOD,
141
145
DR_CFG_AC_OUTDATED_INTVL,
146
+ DR_CFG_LND_LIGHTS_TAXI,
142
147
DR_CHANNEL_ADSB_EXCHANGE_ONLINE,
143
148
DR_CHANNEL_ADSB_EXCHANGE_HISTORIC,
144
149
DR_CHANNEL_OPEN_SKY_ONLINE,
@@ -238,13 +243,28 @@ class DataRefs
238
243
bHeightAGL : 1 ,
239
244
bSpeed : 1 , // default
240
245
bVSI : 1 ;
246
+
247
+ // this is a bit ugly but avoids a wrapper union with an int
248
+ inline int GetInt () const { return *reinterpret_cast <const int *>(this ); }
249
+ inline void SetInt (int i) { *reinterpret_cast <int *>(this ) = i; }
250
+ inline bool operator != (const LabelCfgTy& o) const
251
+ { return GetInt () != o.GetInt (); }
241
252
};
242
253
243
- union LabelCfgUTy {
244
- LabelCfgTy b;
245
- int i;
246
- };
254
+ // when to show a/c labels?
255
+ struct LabelShowCfgTy {
256
+ unsigned
257
+ bExternal : 1 , // external/outside views
258
+ bInternal : 1 , // internal/cockpit views
259
+ bVR : 1 ; // VR views
247
260
261
+ // this is a bit ugly but avoids a wrapper union with an int
262
+ inline int GetInt () const { return *reinterpret_cast <const int *>(this ); }
263
+ inline void SetInt (int i) { *reinterpret_cast <int *>(this ) = i; }
264
+ inline bool operator != (const LabelCfgTy& o) const
265
+ { return GetInt () != o.GetInt (); }
266
+ };
267
+
248
268
struct CSLPathCfgTy { // represents a line in the [CSLPath] section of LiveTrafic.prg
249
269
bool bEnabled = false ;
250
270
std::string path;
@@ -284,8 +304,10 @@ class DataRefs
284
304
285
305
// generic config values
286
306
int bAutoStart = true ; // shall display a/c right after startup?
307
+ int bAIforTCAS = true ; // acquire multiplayer control for TCAS? (false might enhance interperability with other multiplayer clients)
287
308
// which elements make up an a/c label?
288
- LabelCfgUTy labelCfg = { {1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 , 0 ,0 ,1 ,0 ,1 ,0 } };
309
+ LabelCfgTy labelCfg = { 1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 , 0 ,0 ,1 ,0 ,1 ,0 };
310
+ LabelShowCfgTy labelShown = { 1 , 1 , 1 }; // when to show? (default: always)
289
311
bool bLabelColDynamic = false ; // dynamic label color?
290
312
int labelColor = COLOR_YELLOW; // label color, by default yellow
291
313
int maxNumAc = 50 ; // how many aircrafts to create at most?
@@ -295,6 +317,7 @@ class DataRefs
295
317
int fdRefreshIntvl = 20 ; // how often to fetch new flight data
296
318
int fdBufPeriod = 90 ; // seconds to buffer before simulating aircrafts
297
319
int acOutdatedIntvl = 50 ; // a/c considered outdated if latest flight data more older than this compare to 'now'
320
+ int bLndLightsTaxi = false ; // keep landing lights on while taxiing? (to be able to see the a/c as there is no taxi light functionality)
298
321
299
322
vecCSLPaths vCSLPaths; // list of paths to search for CSL packages
300
323
@@ -309,6 +332,12 @@ class DataRefs
309
332
int cntAc = 0 ; // number of a/c being displayed
310
333
std::string keyAc; // key (transpIcao) for a/c whose data is returned
311
334
const LTAircraft* pAc = nullptr ; // ptr to that a/c
335
+
336
+ // MARK: Debug helpers (public)
337
+ public:
338
+ std::string cslFixAcIcaoType; // set of fixed values to use for...
339
+ std::string cslFixOpIcao; // ...newly created aircrafts for...
340
+ std::string cslFixLivery; // ...CSL model package testing
312
341
313
342
// MARK: Constructor
314
343
public:
@@ -329,7 +358,9 @@ class DataRefs
329
358
inline int GetLocalDateDays () const { return XPLMGetDatai (adrXP[DR_LOCAL_DATE_DAYS]); }
330
359
inline bool GetUseSystemTime () const { return XPLMGetDatai (adrXP[DR_USE_SYSTEM_TIME]) != 0 ; }
331
360
inline float GetZuluTimeSec () const { return XPLMGetDataf (adrXP[DR_ZULU_TIME_SEC]); }
332
-
361
+ inline bool IsViewExternal () const { return XPLMGetDatai (adrXP[DR_VIEW_EXTERNAL]) != 0 ; }
362
+ inline bool IsVREnabled () const { return adrXP[DR_VR_ENABLED] ? XPLMGetDatai (adrXP[DR_VR_ENABLED]) != 0 : false ; } // for XP10 compatibility we accept not having this dataRef
363
+
333
364
inline void SetLocalDateDays (int days) { XPLMSetDatai (adrXP[DR_LOCAL_DATE_DAYS], days); }
334
365
inline void SetUseSystemTime (bool bSys) { XPLMSetDatai (adrXP[DR_USE_SYSTEM_TIME], (int )bSys); }
335
366
inline void SetZuluTimeSec (float sec) { XPLMSetDataf (adrXP[DR_ZULU_TIME_SEC], sec); }
@@ -377,7 +408,9 @@ class DataRefs
377
408
static void LTSetCfgValue (void * p, int val);
378
409
bool SetCfgValue (void * p, int val);
379
410
inline bool GetAutoStart () const { return bAutoStart != 0 ; }
380
- inline LabelCfgUTy GetLabelCfg () const { return labelCfg; }
411
+ inline bool GetAIforTCAS () const { return bAIforTCAS != 0 ; }
412
+ inline LabelCfgTy GetLabelCfg () const { return labelCfg; }
413
+ inline LabelShowCfgTy GetLabelShowCfg () const { return labelShown; }
381
414
inline bool IsLabelColorDynamic () const { return bLabelColDynamic; }
382
415
inline int GetLabelColor () const { return labelColor; }
383
416
void GetLabelColor (float outColor[4 ]) const ;
@@ -390,7 +423,8 @@ class DataRefs
390
423
inline int GetFdRefreshIntvl () const { return fdRefreshIntvl; }
391
424
inline int GetFdBufPeriod () const { return fdBufPeriod; }
392
425
inline int GetAcOutdatedIntvl () const { return acOutdatedIntvl; }
393
-
426
+ inline bool GetLndLightsTaxi () const { return bLndLightsTaxi != 0 ; }
427
+
394
428
const vecCSLPaths& GetCSLPaths () const { return vCSLPaths; }
395
429
vecCSLPaths& GetCSLPaths () { return vCSLPaths; }
396
430
void SaveCSLPath (int idx, const CSLPathCfgTy path);
@@ -454,6 +488,7 @@ class DataRefs
454
488
static double GetViewHeading ();
455
489
static inline boundingBoxTy GetBoundingBox (double dist) // bounding box around current view pos
456
490
{ return boundingBoxTy (GetViewPos (), dist); }
491
+ bool ShallDrawLabels () const ;
457
492
};
458
493
459
494
extern DataRefs::dataRefDefinitionT DATA_REFS_LT[CNT_DATAREFS_LT];
0 commit comments