mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Parser: add dive to trip at end of dive-parsing
When adding the dive to its trip before having filled out "when", the dive gets added at the first position (when=0), which is usually not correct. Instead, add the dive to its trip when all fields are correctly filled out. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
911edfca71
commit
0fc58f4534
1 changed files with 4 additions and 4 deletions
|
@ -243,10 +243,6 @@ void dive_start(struct parser_state *state)
|
||||||
state->cur_dive = alloc_dive();
|
state->cur_dive = alloc_dive();
|
||||||
reset_dc_info(&state->cur_dive->dc, state);
|
reset_dc_info(&state->cur_dive->dc, state);
|
||||||
memset(&state->cur_tm, 0, sizeof(state->cur_tm));
|
memset(&state->cur_tm, 0, sizeof(state->cur_tm));
|
||||||
if (state->cur_trip) {
|
|
||||||
add_dive_to_trip(state->cur_dive, state->cur_trip);
|
|
||||||
state->cur_dive->tripflag = IN_TRIP;
|
|
||||||
}
|
|
||||||
state->o2pressure_sensor = 1;
|
state->o2pressure_sensor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +254,10 @@ void dive_end(struct parser_state *state)
|
||||||
free_dive(state->cur_dive);
|
free_dive(state->cur_dive);
|
||||||
else
|
else
|
||||||
record_dive_to_table(state->cur_dive, state->target_table);
|
record_dive_to_table(state->cur_dive, state->target_table);
|
||||||
|
if (state->cur_trip) {
|
||||||
|
add_dive_to_trip(state->cur_dive, state->cur_trip);
|
||||||
|
state->cur_dive->tripflag = IN_TRIP;
|
||||||
|
}
|
||||||
state->cur_dive = NULL;
|
state->cur_dive = NULL;
|
||||||
state->cur_dc = NULL;
|
state->cur_dc = NULL;
|
||||||
state->cur_location.lat.udeg = 0;
|
state->cur_location.lat.udeg = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue