From 9881154489a83711b3a1de9b95e8406d08b7c10b Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 8 Apr 2024 02:26:14 +0200 Subject: [PATCH] correctly show unknown star distances --- src/hud.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index 15ef3a1..2d79945 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -527,7 +527,11 @@ fn update_hud( // Target display let (x, y, z, dist_scalar) : (f64, f64, f64, f64); if let Ok((_, IsClickable { distance: Some(dist), .. })) = q_target.get_single() { - dist_scalar = *dist; + if *dist >= 100000.0 { + dist_scalar = f64::NAN; + } else { + dist_scalar = *dist; + } (x, y, z) = (0.0, 0.0, 0.0); } else { @@ -552,7 +556,10 @@ fn update_hud( } } - if dist_scalar != 0.0 { + if dist_scalar.is_nan() { + text.sections[7].value = format!("distance: UNKNOWN"); + } + else if dist_scalar != 0.0 { text.sections[7].value = format!("{x:.0}m / {z:.0}m / {y:.0}m / distance: {dist_scalar:.0}m"); } else {