diff options
author | Mikko Rasa <tdb@tdb.fi> | 2012-08-29 19:10:26 +0300 |
---|---|---|
committer | Mikko Rasa <tdb@tdb.fi> | 2012-08-29 19:12:18 +0300 |
commit | d6b50e30e405433bdb1edad341ee90c65ae65419 (patch) | |
tree | e620ed4f383748b93d6e63eccbc1aacd6f260b47 /profile.c | |
parent | 9d46581913ce33664e333a4d6eaf7f4e26e20b1c (diff) | |
download | subsurface-d6b50e30e405433bdb1edad341ee90c65ae65419.tar.gz |
Fix profile and average depth for freedives
Freedives can easily exceed the assumed ascent/descent rate, which
results in wacky dive profiles. Add a check to make the ascent and
descent fit within the duration of the dive.
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1387,6 +1387,8 @@ void plot(struct graphics_context *gc, cairo_rectangle_int_t *drawing_area, stru int duration = dive->duration.seconds; int maxdepth = dive->maxdepth.mm; int asc_desc_time = dive->maxdepth.mm*60/9000; + if (asc_desc_time * 2 >= duration) + asc_desc_time = duration / 2; sample = fake; fake[1].time.seconds = asc_desc_time; fake[1].depth.mm = maxdepth; |