From 1046451bbdb4f26547e859340999ef170abf45b1 Mon Sep 17 00:00:00 2001 From: Paris DOUADY Date: Mon, 22 Jan 2024 22:07:35 +0100 Subject: [PATCH] disallow heightfinder to go below water line --- simulation/src/map/objects/road.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/simulation/src/map/objects/road.rs b/simulation/src/map/objects/road.rs index 0d71fea1..75899879 100644 --- a/simulation/src/map/objects/road.rs +++ b/simulation/src/map/objects/road.rs @@ -331,10 +331,13 @@ impl Road { ) .chain(std::iter::once(p.last())) { - let h = env.height(pos).unwrap_or_else(|| { - height_error = true; - 0.0 - }); + let h = env + .height(pos) + .unwrap_or_else(|| { + height_error = true; + 0.0 + }) + .max(0.0); contour.push(h); points.push(pos.z(h)); }