mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: add create_new_cylinder() function
Turn the code in CylindersModel that creates a new cylinder for addition into its own function to avoid code duplication. This will be used from the undo commands. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f1e08fd470
commit
e008b42a59
3 changed files with 12 additions and 5 deletions
|
|
@ -392,6 +392,16 @@ cylinder_t *get_or_create_cylinder(struct dive *d, int idx)
|
|||
return &d->cylinders.cylinders[idx];
|
||||
}
|
||||
|
||||
cylinder_t create_new_cylinder(const struct dive *d)
|
||||
{
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
fill_default_cylinder(d, &cyl);
|
||||
cyl.start = cyl.type.workingpressure;
|
||||
cyl.manually_added = true;
|
||||
cyl.cylinder_use = OC_GAS;
|
||||
return cyl;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CYL
|
||||
void dump_cylinders(struct dive *dive, bool verbose)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue