core: move get_surface_pressure() to struct dive

Feel natural in a C++ code base.

Remove the second parameter, because all callers where passing
`true` anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-30 17:26:12 +02:00 committed by bstoeger
parent 6e29c00f35
commit c812dd140b
5 changed files with 9 additions and 12 deletions

View file

@ -2382,12 +2382,10 @@ bool dive::cache_is_valid() const
return git_id != null_id;
}
int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null)
pressure_t dive::get_surface_pressure() const
{
int mbar = dive->surface_pressure.mbar;
if (!mbar && non_null)
mbar = SURFACE_PRESSURE;
return mbar;
return surface_pressure.mbar > 0 ? surface_pressure
: pressure_t { SURFACE_PRESSURE };
}
/* This returns the conversion factor that you need to multiply