<div dir="ltr">Sorry, I left out the commit message. Patch attached.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On 26 July 2015 at 13:34, Rick Walsh <span dir="ltr"><<a href="mailto:rickmwalsh@gmail.com" target="_blank">rickmwalsh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Rick Walsh <<a href="mailto:rickmwalsh@gmail.com">rickmwalsh@gmail.com</a>><br>
---<br>
planner.c | 17 +++++++++++------<br>
1 file changed, 11 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/planner.c b/planner.c<br>
index 550d463..bff329b 100644<br>
--- a/planner.c<br>
+++ b/planner.c<br>
@@ -29,7 +29,6 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133<br>
91440, 101600, 111760, 121920, 132080, 142240, 152400, 162560, 172720,<br>
182880, 193040, 203200, 223520, 243840, 264160, 284480, 304800,<br>
325120, 345440, 365760, 386080 };<br>
-int decostoplevels[sizeof(decostoplevels_metric) / sizeof(int)];<br>
<br>
double plangflow, plangfhigh;<br>
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;<br>
@@ -885,6 +884,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool<br>
double tissue_tolerance = 0.0;<br>
struct gaschanges *gaschanges = NULL;<br>
int gaschangenr;<br>
+ int *decostoplevels;<br>
+ int decostoplevelcount;<br>
unsigned int *stoplevels = NULL;<br>
bool stopping = false;<br>
bool pendinggaschange = false;<br>
@@ -906,13 +907,17 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool<br>
create_dive_from_plan(diveplan, is_planner);<br>
<br>
if (prefs.units.length == METERS ) {<br>
- memcpy(decostoplevels, decostoplevels_metric, sizeof(decostoplevels_metric));<br>
+ decostoplevels = decostoplevels_metric;<br>
+ decostoplevelcount = sizeof(decostoplevels_metric) / sizeof(int);<br>
} else {<br>
- memcpy(decostoplevels, decostoplevels_imperial, sizeof(decostoplevels_imperial));<br>
+ decostoplevels = decostoplevels_imperial;<br>
+ decostoplevelcount = sizeof(decostoplevels_imperial) / sizeof(int);<br>
}<br>
<br>
if (prefs.last_stop)<br>
- decostoplevels[1] = 0;<br>
+ *(decostoplevels + 1) = 0;<br>
+ else<br>
+ *(decostoplevels + 1) = M_OR_FT(3,10);<br>
<br>
/* Let's start at the last 'sample', i.e. the last manually entered waypoint. */<br>
sample = &displayed_dive.dc.sample[displayed_dive.dc.samples - 1];<br>
@@ -952,8 +957,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool<br>
gaschanges = analyze_gaslist(diveplan, &gaschangenr, depth, &best_first_ascend_cylinder);<br>
}<br>
/* Find the first potential decostopdepth above current depth */<br>
- for (stopidx = 0; stopidx < sizeof(decostoplevels) / sizeof(int); stopidx++)<br>
- if (decostoplevels[stopidx] >= depth)<br>
+ for (stopidx = 0; stopidx < decostoplevelcount; stopidx++)<br>
+ if (*(decostoplevels + stopidx) >= depth)<br>
break;<br>
if (stopidx > 0)<br>
stopidx--;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.4.3<br>
<br>
</font></span></blockquote></div><br></div></div></div>