mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
parser: keep divelist sorted
The parser used to append each parsed dive at the end of the log. At the end the list was sorted. However, the divelist code depends on the list being sorted. To avoid inconsistent states, add the dives at the proper position. Note that the reference data of TestDiveSeabearNewFormat had to be adapted, because the CNS calculation now gives a different value. This shouls be investigated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
124362caa5
commit
4afefb1b9b
4 changed files with 4 additions and 31 deletions
|
@ -262,12 +262,8 @@ void dive_end(struct parser_state *state)
|
|||
if (is_dive(state)) {
|
||||
if (state->cur_trip)
|
||||
state->cur_trip->add_dive(state->cur_dive.get());
|
||||
// Note: we add dives in an unsorted way. The caller of the parsing
|
||||
// function must sort dives.
|
||||
fixup_dive(state->cur_dive.get());
|
||||
state->log->dives.push_back(std::move(state->cur_dive));
|
||||
// This would add dives in a sorted way:
|
||||
// state->log->dives.record_dive(std::move(state->cur_dive));
|
||||
state->log->dives.record_dive(std::move(state->cur_dive));
|
||||
}
|
||||
state->cur_dive.reset();
|
||||
state->cur_dc = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue