changeset 512:e7893664bd29

BUGFIX Spurious stop order when simulating deadly fast ascent.
author JeanDo
date Sun, 04 Dec 2011 17:45:51 +0100
parents 2a6293641d51
children c9f19a546e64
files code_part1/OSTC_code_c_part2/p2_deco.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Nov 25 01:56:17 2011 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sun Dec 04 17:45:51 2011 +0100
@@ -758,9 +758,15 @@
         {
             // Compute tolerated depth, for the leading tissue [metre]:
             overlay float depth_tol = (sim_lead_tissue_limit - pres_surface) * BAR_TO_METER;
+            overlay unsigned char first_stop;
+
+            // If ascent is VERY fast, this can be lower than the actual depth... Because
+            // this happends only in simulation, just forget about it:
+            if( depth_tol > depth )
+                depth_tol = depth;
 
             // Deepest stop, in multiples of 3 metres.
-            overlay unsigned char first_stop = 3 * (short)(0.99999 + depth_tol * 0.33333 );
+            first_stop = 3 * (short)(0.99999 + depth_tol * 0.33333 );
             assert( first_stop < 128 );
 
             // Is it a new deepest needed stop ? If yes this is the reference for