Commit graph

10 commits

Author SHA1 Message Date
Berthold Stoeger
4355ce3924 Cleanup: move copy_cylinder_types() from dive.c to equipment.c
Thus, future callers will not have to include the monster dive.h
include if they just want to copy cylinders.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09 19:19:04 +01:00
Berthold Stoeger
3bb60e8ffe Cleanup: remove unused weightsystem_none() function
This function was used to count the number of weightsystems
used in a dive. Since the weightsysems are now collected
in a dynamic table it became unused. Remove.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18 06:01:07 -07:00
Berthold Stoeger
a5e7f4253a Core: dynamically resize weight table
Replace the fixed-size weightsystem table by a dynamically
relocated table. Reuse the table-macros used in other parts
of the code.

The table stores weightsystem entries, not pointers to
weightsystems. Thus, ownership of the description string is
taken when adding a weightsystem. An extra function adds
a cloned weightsystem at the end of the table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18 06:01:07 -07:00
Berthold Stoeger
efdb3503ea Core: Implement same_weightsystem() function to compare weights
This will be used later when joining and editing dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-07-18 06:00:58 -07:00
Berthold Stoeger
b862e028c6 Cleanup: move cylinderuse_from_text() to equipment.c
Since this function doesn't act on a dive and is only related
to cylinders, move it to equipment.c and equipment.h.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18 05:42:55 -07:00
Berthold Stoeger
b7ff069b02 Cleanup: remove unused macros WEIGHT_IDX_PRIMARY and _SECONDARY
Last users were removed in 34db6dc2be.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00
Berthold Stoeger
3e88bd686f Cleanup: remove unused parameter used from find_best_gasmix_match()
The last direct user of the used parameter was removed in
16276faa45, the last actual user in
e2bbd0ceec.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00
Berthold Stoeger
219c230506 Cleanup: constify two equipment helper functions
add_cylinder_description() and add_weightsystem_description() don't
modify their input parameter. constify them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00
Berthold Stoeger
619d3fb1fd Cleanup: move gas-functions to own translation unit
But only functions that operate only on gases. Functions concerning
cylinders or dives remain in dive.c or are moved to equipment.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00
Berthold Stoeger
529bdef0d6 Cleanup: create equipment.h header
There is an equipment.c file, but no corresponding header. Move the
corresponding functions into a newly created header. This does not
improve compile time since, at least for now, equipment.h is included
in dive.h. But it makes things more consistent.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19 13:11:10 -07:00