aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-25 22:29:07 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-07-27 11:55:05 -0700
commita0cd89f850d727f161eba19e0ee4b19e5aaf8f57 (patch)
treed11a8c60dc03aadc34ae2719ec7d270c4f9fdc07 /tests
parent999a63a5bba58d39a23da34b0eddc37324298699 (diff)
downloadsubsurface-a0cd89f850d727f161eba19e0ee4b19e5aaf8f57.tar.gz
Core: split copy_cylinders() in two functions
copy_cylinders() copied the cylinders of one dive onto another dive and then reset to the original gas values. Presumably, when copy and pasting cylinders from one dive to another, only the types should be copied, not the gases. Moreover, the function could either copy all or only the used cylinders. Firstly, the code was bogus: when restoring the pressures the indices were mixed up: the old indices were used. Thus, when there where uncopied cylinders, not all pressure values were restored. Secondly, it is not clear that all callers actually want to restore the pressure data. It rather appears the two (out of three) callers actually just want to copy the cylinders. Therefore, split the function in 1) copy_cylinders(): copy the cylinders with pressure data 2) copy_cylinder_types(): copy only the cylinder information Since there is only one caller of copy_cylinder_types(), the "used_only" argument can be removed. Since all cylinders are copied there is no point in storing the pressure data. Don't overwrite it in the first place. The resulting two functions should be distinctly easier to understand. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions