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
parent 64945a1c96
commit e9c14c523c
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);
}