mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: bring sanity to the SAC rate handling
The old implementation was... let's call it creative. This tries to actually get things right instead of using magic. Don't pretend that double values are ints. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
150676ce3d
commit
6ed189f32c
5 changed files with 61 additions and 48 deletions
9
dive.c
9
dive.c
|
@ -188,15 +188,12 @@ double get_volume_units(unsigned int ml, int *frac, const char **units)
|
|||
return vol;
|
||||
}
|
||||
|
||||
int units_to_sac(int volume)
|
||||
int units_to_sac(double volume)
|
||||
{
|
||||
if(get_units()->volume == CUFT)
|
||||
if (volume < 10)
|
||||
return cuft_to_l(volume) * 100;
|
||||
else
|
||||
return cuft_to_l(volume) * 10;
|
||||
return rint(cuft_to_l(volume) * 1000.0);
|
||||
else
|
||||
return volume * 1000;
|
||||
return rint(volume * 1000);
|
||||
}
|
||||
|
||||
unsigned int units_to_depth(double depth)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue