From c61ca58ac1076b4037eabf8ad67d5a29f4343c0e Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 11 Jul 2017 16:17:18 +0200 Subject: [PATCH] variable initialized --- src/bearingcompass.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bearingcompass.cpp b/src/bearingcompass.cpp index 0f04e8e..1294647 100644 --- a/src/bearingcompass.cpp +++ b/src/bearingcompass.cpp @@ -69,6 +69,7 @@ TacticsInstrument_Dial(parent, id, title, cap_flag, 0, 360, 0, 360) m_CurrDir = NAN; m_CurrSpeed = NAN; m_ExtraValueDTW = NAN; + m_MainValue = NAN; m_Leeway = 0; m_AngleStart = 0; m_ExpSmoothDegRange = 0; @@ -82,6 +83,7 @@ TacticsInstrument_Dial(parent, id, title, cap_flag, 0, 360, 0, 360) m_TWS = NAN; m_TWD = NAN; m_StW = 0.0; + m_ToWpt = _T("---"); alpha_diffCogHdt = 0.1; m_ExpSmoothDiffCogHdt = 0; m_oldExpSmoothDiffCogHdt = 0; @@ -95,9 +97,9 @@ void TacticsInstrument_BearingCompass::SetData(int st, double data, wxString uni m_Cog = data; } else if (st == OCPN_DBP_STC_HDT) { - m_AngleStart = -data; //neu - m_MainValue = data; //neu - m_MainValueUnit = unit;//neu + m_AngleStart = -data; + m_MainValue = data; + m_MainValueUnit = unit; m_Hdt = data; } else if (st == OCPN_DBP_STC_CURRDIR) { @@ -215,9 +217,8 @@ void TacticsInstrument_BearingCompass::Draw(wxGCDC* bdc) DrawForeground(bdc); DrawLaylines(bdc); - DrawData(bdc, m_MainValue, m_MainValueUnit, _T("%.0f"), DIAL_POSITION_TOPINSIDE); + if (!wxIsNaN(m_MainValue)) DrawData(bdc, m_MainValue, m_MainValueUnit, _T("%.0f"), DIAL_POSITION_TOPINSIDE); -// DrawData(bdc, m_predictedSog, _T("kn "), _T("prd.SOG: ~%.1f"), DIAL_POSITION_BOTTOMRIGHT); if (!wxIsNaN(m_predictedSog)) DrawData(bdc, m_predictedSog, getUsrSpeedUnit_Plugin(g_iDashSpeedUnit), _T("prd.SOG: ~%.1f"), DIAL_POSITION_BOTTOMRIGHT);