core: turn M_OR_FT macro into a function

No point in this being a macro. Make it return a depth_t - it
was unclear that this returns a depth in mm.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-12-14 10:10:19 +01:00 committed by Michael Keller
parent 0e77dd9a68
commit bd2f7e72f1
11 changed files with 105 additions and 97 deletions

View file

@ -199,3 +199,8 @@ unsigned int get_distance(location_t loc1, location_t loc2)
return lrint(6371000 * c);
}
depth_t m_or_ft(int m, int ft)
{
int mm = prefs.units.length == units::METERS ? m * 1000 : feet_to_mm(ft);
return depth_t::from_base(mm);
}