From 9cb2fc4c9c28b06e70dbc4ef49eb63b37a2175ef Mon Sep 17 00:00:00 2001 From: TwinFan Date: Sat, 26 Jan 2019 00:47:21 +0100 Subject: [PATCH] Added ai_for_tcas, label_shown (in/external/VR), lnd_lights_taxi,... ...and debug fixings for CSL model matching (a/c, op, livery) as basis for full functionality and settings UI to come. --- Src/DataRefs.cpp | 31 ++++++++++++++++++++--- Src/Include/DataRefs.h | 51 ++++++++++++++++++++++++++++++++------ Src/Include/LTFlightData.h | 2 +- Src/LTAircraft.cpp | 13 ++++++---- Src/LTFlightData.cpp | 22 ++++++++-------- Src/SettingsUI.cpp | 41 +++++++++++++++++------------- 6 files changed, 115 insertions(+), 45 deletions(-) diff --git a/Src/DataRefs.cpp b/Src/DataRefs.cpp index a353fec1..974c040d 100644 --- a/Src/DataRefs.cpp +++ b/Src/DataRefs.cpp @@ -179,6 +179,8 @@ const char* DATA_REFS_XP[CNT_DATAREFS_XP] = { "sim/time/local_date_days", "sim/time/use_system_time", "sim/time/zulu_time_sec", + "sim/graphics/view/view_is_external", + "sim/graphics/VR/enabled", }; // @@ -216,7 +218,9 @@ DataRefs::dataRefDefinitionT DATA_REFS_LT[] = { {"livetraffic/sim/time", DataRefs::LTGetSimDateTime, DataRefs::LTSetSimDateTime, (void*)2, false }, {"livetraffic/cfg/aircrafts_displayed", DataRefs::LTGetInt, DataRefs::LTSetAircraftsDisplayed, GET_VAR, false }, {"livetraffic/cfg/auto_start", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, + {"livetraffic/cfg/ai_for_tcas", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/labels", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, + {"livetraffic/cfg/label_shown", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/label_col_dyn", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/label_color", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/log_level", DataRefs::LTGetInt, DataRefs::LTSetLogLevel, GET_VAR, true }, @@ -228,6 +232,7 @@ DataRefs::dataRefDefinitionT DATA_REFS_LT[] = { {"livetraffic/cfg/fd_refresh_intvl", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/fd_buf_period", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/cfg/ac_outdated_intvl", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, + {"livetraffic/cfg/lnd_lights_taxi", DataRefs::LTGetInt, DataRefs::LTSetCfgValue, GET_VAR, true }, {"livetraffic/channel/adsb_exchange/online", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true }, {"livetraffic/channel/adsb_exchange/historic", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true }, {"livetraffic/channel/open_sky/online", DataRefs::LTGetInt, DataRefs::LTSetBool, GET_VAR, true }, @@ -249,7 +254,9 @@ void* DataRefs::getVarAddr (dataRefsLT dr) switch (dr) { case DR_CFG_AIRCRAFTS_DISPLAYED: return &bShowingAircrafts; case DR_CFG_AUTO_START: return &bAutoStart; - case DR_CFG_LABELS: return &labelCfg.i; + case DR_CFG_AI_FOR_TCAS: return &bAIforTCAS; + case DR_CFG_LABELS: return &labelCfg; + case DR_CFG_LABEL_SHOWN: return &labelShown; case DR_CFG_LABEL_COL_DYN: return &bLabelColDynamic; case DR_CFG_LABEL_COLOR: return &labelColor; case DR_CFG_LOG_LEVEL: return &iLogLevel; @@ -261,6 +268,7 @@ void* DataRefs::getVarAddr (dataRefsLT dr) case DR_CFG_FD_REFRESH_INTVL: return &fdRefreshIntvl; case DR_CFG_FD_BUF_PERIOD: return &fdBufPeriod; case DR_CFG_AC_OUTDATED_INTVL: return &acOutdatedIntvl; + case DR_CFG_LND_LIGHTS_TAXI: return &bLndLightsTaxi; case DR_DBG_AC_FILTER: return &uDebugAcFilter; case DR_DBG_AC_POS: return &bDebugAcPos; @@ -435,7 +443,14 @@ bool DataRefs::Init () for ( int i=0; i < CNT_DATAREFS_XP; i++ ) { if ( (adrXP[i] = XPLMFindDataRef (DATA_REFS_XP[i])) == NULL ) - { LOG_MSG(logFATAL,ERR_DATAREF_FIND,DATA_REFS_XP[i]); return false; } + { + // for XP10 compatibility we accept if we don't find "VR/enabled", + // all else stays an error + if (i != DR_VR_ENABLED) { + LOG_MSG(logFATAL,ERR_DATAREF_FIND,DATA_REFS_XP[i]); + return false; + } + } } // register all LiveTraffic-provided dataRefs @@ -945,7 +960,7 @@ bool DataRefs::SetCfgValue (void* p, int val) } // Tell XPMP if we need labels - if (labelCfg.i > 0) + if (ShallDrawLabels()) XPMPEnableAircraftLabels(); else XPMPDisableAircraftLabels(); @@ -1441,3 +1456,13 @@ double DataRefs::GetViewHeading() XPLMReadCameraPosition(&camPos); return camPos.heading; } + +bool DataRefs::ShallDrawLabels() const +{ + // user doesn't want labels in VR but is in VR mode? -> no labels + if (!labelShown.bVR && IsVREnabled()) + return false; + + // now depends on internal or external view + return IsViewExternal() ? labelShown.bExternal : labelShown.bInternal; +} diff --git a/Src/Include/DataRefs.h b/Src/Include/DataRefs.h index 04ae6471..7d22c065 100644 --- a/Src/Include/DataRefs.h +++ b/Src/Include/DataRefs.h @@ -95,6 +95,8 @@ enum dataRefsXP { DR_LOCAL_DATE_DAYS, DR_USE_SYSTEM_TIME, DR_ZULU_TIME_SEC, + DR_VIEW_EXTERNAL, + DR_VR_ENABLED, CNT_DATAREFS_XP // always last, number of elements }; @@ -127,7 +129,9 @@ enum dataRefsLT { DR_SIM_TIME, DR_CFG_AIRCRAFTS_DISPLAYED, DR_CFG_AUTO_START, + DR_CFG_AI_FOR_TCAS, DR_CFG_LABELS, + DR_CFG_LABEL_SHOWN, DR_CFG_LABEL_COL_DYN, DR_CFG_LABEL_COLOR, DR_CFG_LOG_LEVEL, @@ -139,6 +143,7 @@ enum dataRefsLT { DR_CFG_FD_REFRESH_INTVL, DR_CFG_FD_BUF_PERIOD, DR_CFG_AC_OUTDATED_INTVL, + DR_CFG_LND_LIGHTS_TAXI, DR_CHANNEL_ADSB_EXCHANGE_ONLINE, DR_CHANNEL_ADSB_EXCHANGE_HISTORIC, DR_CHANNEL_OPEN_SKY_ONLINE, @@ -238,13 +243,28 @@ class DataRefs bHeightAGL : 1, bSpeed : 1, // default bVSI : 1; + + // this is a bit ugly but avoids a wrapper union with an int + inline int GetInt() const { return *reinterpret_cast(this); } + inline void SetInt(int i) { *reinterpret_cast(this) = i; } + inline bool operator != (const LabelCfgTy& o) const + { return GetInt() != o.GetInt(); } }; - union LabelCfgUTy { - LabelCfgTy b; - int i; - }; + // when to show a/c labels? + struct LabelShowCfgTy { + unsigned + bExternal : 1, // external/outside views + bInternal : 1, // internal/cockpit views + bVR : 1; // VR views + // this is a bit ugly but avoids a wrapper union with an int + inline int GetInt() const { return *reinterpret_cast(this); } + inline void SetInt(int i) { *reinterpret_cast(this) = i; } + inline bool operator != (const LabelCfgTy& o) const + { return GetInt() != o.GetInt(); } + }; + struct CSLPathCfgTy { // represents a line in the [CSLPath] section of LiveTrafic.prg bool bEnabled = false; std::string path; @@ -284,8 +304,10 @@ class DataRefs // generic config values int bAutoStart = true; // shall display a/c right after startup? + int bAIforTCAS = true; // acquire multiplayer control for TCAS? (false might enhance interperability with other multiplayer clients) // which elements make up an a/c label? - LabelCfgUTy labelCfg = { {1,1,0,0,0,0,0,0, 0,0,1,0,1,0} }; + LabelCfgTy labelCfg = { 1,1,0,0,0,0,0,0, 0,0,1,0,1,0 }; + LabelShowCfgTy labelShown = { 1, 1, 1 }; // when to show? (default: always) bool bLabelColDynamic = false; // dynamic label color? int labelColor = COLOR_YELLOW; // label color, by default yellow int maxNumAc = 50; // how many aircrafts to create at most? @@ -295,6 +317,7 @@ class DataRefs int fdRefreshIntvl = 20; // how often to fetch new flight data int fdBufPeriod = 90; // seconds to buffer before simulating aircrafts int acOutdatedIntvl = 50; // a/c considered outdated if latest flight data more older than this compare to 'now' + int bLndLightsTaxi = false; // keep landing lights on while taxiing? (to be able to see the a/c as there is no taxi light functionality) vecCSLPaths vCSLPaths; // list of paths to search for CSL packages @@ -309,6 +332,12 @@ class DataRefs int cntAc = 0; // number of a/c being displayed std::string keyAc; // key (transpIcao) for a/c whose data is returned const LTAircraft* pAc = nullptr; // ptr to that a/c + +//MARK: Debug helpers (public) +public: + std::string cslFixAcIcaoType; // set of fixed values to use for... + std::string cslFixOpIcao; // ...newly created aircrafts for... + std::string cslFixLivery; // ...CSL model package testing //MARK: Constructor public: @@ -329,7 +358,9 @@ class DataRefs inline int GetLocalDateDays() const { return XPLMGetDatai(adrXP[DR_LOCAL_DATE_DAYS]); } inline bool GetUseSystemTime() const { return XPLMGetDatai(adrXP[DR_USE_SYSTEM_TIME]) != 0; } inline float GetZuluTimeSec() const { return XPLMGetDataf(adrXP[DR_ZULU_TIME_SEC]); } - + inline bool IsViewExternal() const { return XPLMGetDatai(adrXP[DR_VIEW_EXTERNAL]) != 0; } + 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 + inline void SetLocalDateDays(int days) { XPLMSetDatai(adrXP[DR_LOCAL_DATE_DAYS], days); } inline void SetUseSystemTime(bool bSys) { XPLMSetDatai(adrXP[DR_USE_SYSTEM_TIME], (int)bSys); } inline void SetZuluTimeSec(float sec) { XPLMSetDataf(adrXP[DR_ZULU_TIME_SEC], sec); } @@ -377,7 +408,9 @@ class DataRefs static void LTSetCfgValue(void* p, int val); bool SetCfgValue(void* p, int val); inline bool GetAutoStart() const { return bAutoStart != 0; } - inline LabelCfgUTy GetLabelCfg() const { return labelCfg; } + inline bool GetAIforTCAS() const { return bAIforTCAS != 0; } + inline LabelCfgTy GetLabelCfg() const { return labelCfg; } + inline LabelShowCfgTy GetLabelShowCfg() const { return labelShown; } inline bool IsLabelColorDynamic() const { return bLabelColDynamic; } inline int GetLabelColor() const { return labelColor; } void GetLabelColor (float outColor[4]) const; @@ -390,7 +423,8 @@ class DataRefs inline int GetFdRefreshIntvl() const { return fdRefreshIntvl; } inline int GetFdBufPeriod() const { return fdBufPeriod; } inline int GetAcOutdatedIntvl() const { return acOutdatedIntvl; } - + inline bool GetLndLightsTaxi() const { return bLndLightsTaxi != 0; } + const vecCSLPaths& GetCSLPaths() const { return vCSLPaths; } vecCSLPaths& GetCSLPaths() { return vCSLPaths; } void SaveCSLPath(int idx, const CSLPathCfgTy path); @@ -454,6 +488,7 @@ class DataRefs static double GetViewHeading(); static inline boundingBoxTy GetBoundingBox(double dist) // bounding box around current view pos { return boundingBoxTy(GetViewPos(), dist); } + bool ShallDrawLabels() const; }; extern DataRefs::dataRefDefinitionT DATA_REFS_LT[CNT_DATAREFS_LT]; diff --git a/Src/Include/LTFlightData.h b/Src/Include/LTFlightData.h index ecb78d44..c6e6e7f9 100644 --- a/Src/Include/LTFlightData.h +++ b/Src/Include/LTFlightData.h @@ -159,7 +159,7 @@ class LTFlightData int sig; // signal level std::string labelStat; // static part of the a/c label - DataRefs::LabelCfgUTy labelCfg = { {0,0,0,0,0,0,0,0,0,0,0,0,0} }; // the configuration the label was saved for + DataRefs::LabelCfgTy labelCfg = { 0,0,0,0,0,0,0,0,0,0,0,0,0 }; // the configuration the label was saved for protected: // DYNAMIC DATA (protected, access will be mutex-controlled for thread-safety) diff --git a/Src/LTAircraft.cpp b/Src/LTAircraft.cpp index ac9e91ac..cbca8362 100644 --- a/Src/LTAircraft.cpp +++ b/Src/LTAircraft.cpp @@ -826,9 +826,12 @@ std::string LTAircraft::FlightPhase2String (FlightPhase phase) // Constructor: create an aircraft from Flight Data LTAircraft::LTAircraft(LTFlightData& inFd) : // Base class -> this registers with XPMP API for actual display in XP! -XPCAircraft(inFd.WaitForSafeCopyStat().acTypeIcao.c_str(), // repeated calls to WaitForSafeCopyStat look inefficient - inFd.WaitForSafeCopyStat().opIcao.c_str(), // ...but if the lock is held by the calling function already then these are quick recursive calls - inFd.WaitForSafeCopyStat().reg.c_str()), // Using registration as livery indicator, allows for different liveries per actual airframe +// repeated calls to WaitForSafeCopyStat look inefficient, but if the lock is held by the calling function already then these are quick recursive calls +// Using registration as livery indicator, allows for different liveries per actual airframe +// Debug options to set fixed type/op/livery take precedence +XPCAircraft(str_first_non_empty({dataRefs.cslFixAcIcaoType, inFd.WaitForSafeCopyStat().acTypeIcao}).c_str(), + str_first_non_empty({dataRefs.cslFixOpIcao, inFd.WaitForSafeCopyStat().opIcao}).c_str(), + str_first_non_empty({dataRefs.cslFixLivery, inFd.WaitForSafeCopyStat().reg}).c_str()), // class members fd(inFd), mdl(FlightModel::FindFlightModel(inFd.WaitForSafeCopyStat().acTypeIcao)), // find matching flight model @@ -1471,7 +1474,7 @@ void LTAircraft::CalcFlightModel (const positionTy& /*from*/, const positionTy& // some assumption to begin with... surfaces.thrust = 0.1f; surfaces.lights.timeOffset = (unsigned int)rand(); - surfaces.lights.landLights = 0; + surfaces.lights.landLights = dataRefs.GetLndLightsTaxi() ? 1 : 0; surfaces.lights.bcnLights = 1; surfaces.lights.strbLights = 0; surfaces.lights.navLights = 1; @@ -1587,7 +1590,7 @@ void LTAircraft::CalcFlightModel (const positionTy& /*from*/, const positionTy& flaps.up(); surfaces.spoilerRatio = surfaces.speedBrakeRatio = 0.0; surfaces.thrust = 0.1f; - surfaces.lights.landLights = 0; + surfaces.lights.landLights = dataRefs.GetLndLightsTaxi() ? 1 : 0; surfaces.lights.strbLights = 0; } diff --git a/Src/LTFlightData.cpp b/Src/LTFlightData.cpp index 5c693fd7..edcc8ce4 100644 --- a/Src/LTFlightData.cpp +++ b/Src/LTFlightData.cpp @@ -306,18 +306,18 @@ void LTFlightData::UpdateStaticLabel() std::lock_guard lock (dataAccessMutex); // the configuration: which parts to include in the label? - const DataRefs::LabelCfgUTy cfg = dataRefs.GetLabelCfg(); + const DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg(); // add parts as per config labelStat.clear(); - ADD_LABEL(cfg.b.bIcaoType, statData.acTypeIcao); - ADD_LABEL(cfg.b.bAnyAcId, statData.acId(key())); - ADD_LABEL(cfg.b.bTranspCode, key()); - ADD_LABEL(cfg.b.bReg, statData.reg); - ADD_LABEL(cfg.b.bIcaoOp, statData.opIcao); - ADD_LABEL(cfg.b.bCallSign, statData.call); - ADD_LABEL(cfg.b.bFlightNo, statData.flight); - ADD_LABEL(cfg.b.bRoute, statData.route()); + ADD_LABEL(cfg.bIcaoType, statData.acTypeIcao); + ADD_LABEL(cfg.bAnyAcId, statData.acId(key())); + ADD_LABEL(cfg.bTranspCode, key()); + ADD_LABEL(cfg.bReg, statData.reg); + ADD_LABEL(cfg.bIcaoOp, statData.opIcao); + ADD_LABEL(cfg.bCallSign, statData.call); + ADD_LABEL(cfg.bFlightNo, statData.flight); + ADD_LABEL(cfg.bRoute, statData.route()); // this is the config we did the label for labelCfg = cfg; @@ -336,7 +336,7 @@ std::string LTFlightData::ComposeLabel() const std::lock_guard lock (dataAccessMutex); // the configuration: which parts to include in the label? - const DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg().b; + const DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg(); std::string label(labelStat); // copy static parts // only possible if we have an aircraft @@ -1691,7 +1691,7 @@ bool LTFlightData::AircraftMaintenance ( double simTime ) return true; // do we need to recalc the static part of the a/c label due to config change? - if (dataRefs.GetLabelCfg().i != labelCfg.i) + if (dataRefs.GetLabelCfg() != labelCfg) UpdateStaticLabel(); // doesn't yet have an associated aircraft but two positions? diff --git a/Src/SettingsUI.cpp b/Src/SettingsUI.cpp index 8fbafe9b..aaec0005 100644 --- a/Src/SettingsUI.cpp +++ b/Src/SettingsUI.cpp @@ -138,6 +138,7 @@ enum UI_WIDGET_IDX_T { UI_BTN_AC_LABELS, UI_BTN_ADVANCED, UI_BTN_CSL, + UI_BTN_DEBUG, // "Basics" tab UI_BASICS_LIVE_SUB_WND, UI_BASICS_BTN_ENABLE, @@ -245,6 +246,9 @@ enum UI_WIDGET_IDX_T { UI_CSL_TXT_DEFAULT_AC_TYPE, UI_CSL_CAP_GROUND_VEHICLE_TYPE, UI_CSL_TXT_GROUND_VEHICLE_TYPE, + + // "Debug" tab + UI_DEBUG_SUB_WND, // always last: number of UI elements UI_NUMBER_OF_ELEMENTS @@ -260,6 +264,7 @@ TFWidgetCreate_t SETTINGS_UI[] = { 85, 30, 75, 10, 1, "A/C Labels", 0, UI_MAIN_WND, xpWidgetClass_Button, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton, 0,0, 0,0} }, { 160, 30, 75, 10, 1, "Advanced", 0, UI_MAIN_WND, xpWidgetClass_Button, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton, 0,0, 0,0} }, { 235, 30, 75, 10, 1, "CSL", 0, UI_MAIN_WND, xpWidgetClass_Button, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton, 0,0, 0,0} }, + { 310, 30, 75, 10, 1, "Debug", 0, UI_MAIN_WND, xpWidgetClass_Button, {xpProperty_ButtonBehavior, xpButtonBehaviorRadioButton, 0,0, 0,0} }, // "Basics" tab { 10, 50, 190, -10, 0, "Basics Live", 0, UI_MAIN_WND, xpWidgetClass_SubWindow, {0,0, 0,0, 0,0} }, { 10, 10, 10, 10, 1, "Show Live Aircrafts", 0, UI_BASICS_LIVE_SUB_WND, xpWidgetClass_Button, {xpProperty_ButtonType, xpRadioButton, xpProperty_ButtonBehavior, xpButtonBehaviorCheckBox, 0,0} }, @@ -359,6 +364,8 @@ TFWidgetCreate_t SETTINGS_UI[] = { 120, 227, 50, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField,{xpProperty_MaxCharacters,4, 0,0, 0,0} }, { 5, 250, 115, 10, 1, "Ground vehicle type", 0, UI_CSL_SUB_WND, xpWidgetClass_Caption, {0,0, 0,0, 0,0} }, { 120, 247, 50, 15, 1, "", 0, UI_CSL_SUB_WND, xpWidgetClass_TextField,{xpProperty_MaxCharacters,4, 0,0, 0,0} }, + // "Debug" tab + { 10, 50, -10, -10, 0, "Debug", 0, UI_MAIN_WND, xpWidgetClass_SubWindow, {0,0,0,0,0,0} }, }; @@ -704,7 +711,7 @@ bool LTSettingsUI::MsgPushButtonPressed (XPWidgetID buttonWidget) void LTSettingsUI::LabelBtnInit() { // read current label configuration and init the checkboxes accordingly - DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg().b; + DataRefs::LabelCfgTy cfg = dataRefs.GetLabelCfg(); XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_TYPE],xpProperty_ButtonState,cfg.bIcaoType); XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_AC_ID],xpProperty_ButtonState,cfg.bAnyAcId); XPSetWidgetProperty(widgetIds[UI_LABELS_BTN_TRANSP],xpProperty_ButtonState,cfg.bTranspCode); @@ -724,23 +731,23 @@ void LTSettingsUI::LabelBtnInit() void LTSettingsUI::LabelBtnSave() { // store the checkboxes states in a zero-inited configuration - DataRefs::LabelCfgUTy cfg = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - cfg.b.bIcaoType = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TYPE],xpProperty_ButtonState,NULL); - cfg.b.bAnyAcId = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_AC_ID],xpProperty_ButtonState,NULL); - cfg.b.bTranspCode = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TRANSP],xpProperty_ButtonState,NULL); - cfg.b.bReg = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_REG],xpProperty_ButtonState,NULL); - cfg.b.bIcaoOp = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_OP],xpProperty_ButtonState,NULL); - cfg.b.bCallSign = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_CALL_SIGN],xpProperty_ButtonState,NULL); - cfg.b.bFlightNo = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_FLIGHT_NO],xpProperty_ButtonState,NULL); - cfg.b.bRoute = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ROUTE],xpProperty_ButtonState,NULL); - cfg.b.bPhase = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_PHASE],xpProperty_ButtonState,NULL); - cfg.b.bHeading = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEADING],xpProperty_ButtonState,NULL); - cfg.b.bAlt = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ALT],xpProperty_ButtonState,NULL); - cfg.b.bHeightAGL = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEIGHT],xpProperty_ButtonState,NULL); - cfg.b.bSpeed = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_SPEED],xpProperty_ButtonState,NULL); - cfg.b.bVSI = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_VSI],xpProperty_ButtonState,NULL); + DataRefs::LabelCfgTy cfg = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + cfg.bIcaoType = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TYPE],xpProperty_ButtonState,NULL); + cfg.bAnyAcId = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_AC_ID],xpProperty_ButtonState,NULL); + cfg.bTranspCode = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_TRANSP],xpProperty_ButtonState,NULL); + cfg.bReg = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_REG],xpProperty_ButtonState,NULL); + cfg.bIcaoOp = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_OP],xpProperty_ButtonState,NULL); + cfg.bCallSign = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_CALL_SIGN],xpProperty_ButtonState,NULL); + cfg.bFlightNo = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_FLIGHT_NO],xpProperty_ButtonState,NULL); + cfg.bRoute = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ROUTE],xpProperty_ButtonState,NULL); + cfg.bPhase = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_PHASE],xpProperty_ButtonState,NULL); + cfg.bHeading = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEADING],xpProperty_ButtonState,NULL); + cfg.bAlt = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_ALT],xpProperty_ButtonState,NULL); + cfg.bHeightAGL = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_HEIGHT],xpProperty_ButtonState,NULL); + cfg.bSpeed = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_SPEED],xpProperty_ButtonState,NULL); + cfg.bVSI = (unsigned)XPGetWidgetProperty(widgetIds[UI_LABELS_BTN_VSI],xpProperty_ButtonState,NULL); // save as current config - drCfgLabels.Set(cfg.i); + drCfgLabels.Set(cfg.GetInt()); } void LTSettingsUI::SaveCSLPath(int idx)