Core: pass dive, cylinder-id to fill_default_cylinder

The fill_default_cylinder() function calculated the MOD based
on the currently displayed dive. This does not seem to make sense:
- When importing dives, why would we care about the altitude and
  salinity of the currently displayed dive, possibly from a different
  trip.
- The planner is supposed to be thread-safe and should not touch
  global variables.

Of course this means that the importing-functions have to fill
out altitude and salinity before creating the default cylinder,
but this is their problem. For a freshly created dive they will
get the default values, which still seems less random than the
values from the displayed dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-06 11:19:32 +02:00 committed by Dirk Hohndel
parent 6ce4aeb04e
commit 00944f7a02
7 changed files with 11 additions and 10 deletions

View file

@ -224,7 +224,7 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
if (no_volume) {
/* for the first tank, if there is no tanksize available from the
* dive computer, fill in the default tank information (if set) */
fill_default_cylinder(&dive->cylinder[i]);
fill_default_cylinder(dive, i);
}
/* whatever happens, make sure there is a name for the cylinder */
if (empty_string(dive->cylinder[i].type.description))