summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-03 14:45:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-03 14:45:01 -0700
commit611bae344111845bfa8bd676c0fad49d1c051c10 (patch)
tree6500f730170eb455fcceeacdc900316a44682f24 /planner.c
parentd8c31135848d765a3d241d295e5d6afc311f7820 (diff)
downloadsubsurface-611bae344111845bfa8bd676c0fad49d1c051c10.tar.gz
UI restructure: use displayed_dive for add dive and plan dive
This gets rid of the stagingDive and stops the constant adding and removing of dives from the divelist (that was an INSANE design, seriously). When adding or planning a dive all work is now done in the dedicated displayed_dive. Add dive mostly works - when the user clicks save the dive is added to the dive list and selected. Plan dive is mostly untested. It passed trivial "start planner, save" testing so it's not entirely broken, but I'm sure there's more work to be done there. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/planner.c b/planner.c
index 0c398bacb..a3f0c0b62 100644
--- a/planner.c
+++ b/planner.c
@@ -257,14 +257,14 @@ static void create_dive_from_plan(struct diveplan *diveplan)
printf("in create_dive_from_plan\n");
dump_plan(diveplan);
#endif
- // clear out the dive, fill in the basics and get started
- clear_dive(&displayed_dive);
- displayed_dive.when = diveplan->when;
- displayed_dive.dc.surface_pressure.mbar = diveplan->surface_pressure;
+ // reset the cylinders and clear out the samples of the displayed dive so we can restart
+ reset_cylinders(&displayed_dive);
dc = &displayed_dive.dc;
- dc->model = "planned dive"; /* do not translate here ! */
+ free(dc->sample);
+ dc->sample = NULL;
+ dc->samples = 0;
+ dc->alloc_samples = 0;
dp = diveplan->dp;
- reset_cylinders(&displayed_dive);
cyl = &displayed_dive.cylinder[0];
oldgasmix = cyl->gasmix;
sample = prepare_sample(dc);