# HG changeset patch
# User JeanDo
# Date 1323017151 -3600
# Node ID e7893664bd29cffe58068842cec0ff34f90e7c7b
# Parent  2a6293641d51149b36123cada504b8ecc3d82c4a
BUGFIX Spurious stop order when simulating deadly fast ascent.

diff -r 2a6293641d51 -r e7893664bd29 code_part1/OSTC_code_c_part2/p2_deco.c
--- 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