diff --git a/src/xswiftbus/terrainprobe.cpp b/src/xswiftbus/terrainprobe.cpp index baee8a3db..07b1e9c48 100644 --- a/src/xswiftbus/terrainprobe.cpp +++ b/src/xswiftbus/terrainprobe.cpp @@ -27,16 +27,21 @@ namespace XSwiftBus auto result = XPLMProbeTerrainXYZ(m_ref, static_cast(x), static_cast(y), static_cast(z), &probe); if (result != xplm_ProbeHitTerrain) { - std::string error; - if (result == xplm_ProbeError) { error = "probe error"; } - else if (result == xplm_ProbeMissed) { error = "probe missed"; } - else { error = "unknown probe result"; } - WARNING_LOG(callsign + " " + error + " at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude)); + if (m_logMessageCount < 100) + { + m_logMessageCount++; + std::string error; + if (result == xplm_ProbeError) { error = "probe error"; } + else if (result == xplm_ProbeMissed) { error = "probe missed"; } + else { error = "unknown probe result"; } + WARNING_LOG(callsign + " " + error + " at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude)); + } return std::numeric_limits::quiet_NaN(); } - if (probe.is_wet) + if (probe.is_wet && m_logMessageCount < 100) { + m_logMessageCount++; DEBUG_LOG(callsign + " probe hit water at " + std::to_string(degreesLatitude) + ", " + std::to_string(degreesLongitude) + ", " + std::to_string(metersAltitude)); } diff --git a/src/xswiftbus/terrainprobe.h b/src/xswiftbus/terrainprobe.h index 55c301077..2a9f6e368 100644 --- a/src/xswiftbus/terrainprobe.h +++ b/src/xswiftbus/terrainprobe.h @@ -39,6 +39,7 @@ namespace XSwiftBus private: XPLMProbeRef m_ref = nullptr; + mutable int m_logMessageCount = 0; }; } // ns