mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:33:23 +00:00
core: introduce clone_cylinder() function
We have a clone_weightsystem function. For symmetry, introduce a clone_cylinder() function so that we can more-or-less copy&paste the weightsystem undo code for cylinder undo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
64a5f10cfe
commit
2453d4fc1f
2 changed files with 9 additions and 2 deletions
|
@ -137,12 +137,18 @@ void add_cloned_weightsystem_at(struct weightsystem_table *t, weightsystem_t ws)
|
|||
add_to_weightsystem_table(t, t->nr, clone_weightsystem(ws));
|
||||
}
|
||||
|
||||
cylinder_t clone_cylinder(cylinder_t cyl)
|
||||
{
|
||||
cylinder_t res = cyl;
|
||||
res.type.description = copy_string(res.type.description);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Add a clone of a cylinder to the end of a cylinder table.
|
||||
* Cloned in means that the description-string is copied. */
|
||||
void add_cloned_cylinder(struct cylinder_table *t, cylinder_t cyl)
|
||||
{
|
||||
cyl.type.description = copy_string(cyl.type.description);
|
||||
add_to_cylinder_table(t, t->nr, cyl);
|
||||
add_to_cylinder_table(t, t->nr, clone_cylinder(cyl));
|
||||
}
|
||||
|
||||
bool same_weightsystem(weightsystem_t w1, weightsystem_t w2)
|
||||
|
|
|
@ -75,6 +75,7 @@ extern weightsystem_t clone_weightsystem(weightsystem_t ws);
|
|||
extern void free_weightsystem(weightsystem_t ws);
|
||||
extern void copy_cylinder_types(const struct dive *s, struct dive *d);
|
||||
extern void add_cloned_weightsystem(struct weightsystem_table *t, weightsystem_t ws);
|
||||
extern cylinder_t clone_cylinder(cylinder_t cyl);
|
||||
extern cylinder_t *add_empty_cylinder(struct cylinder_table *t);
|
||||
extern void add_cloned_cylinder(struct cylinder_table *t, cylinder_t cyl);
|
||||
extern cylinder_t *get_cylinder(const struct dive *d, int idx);
|
||||
|
|
Loading…
Add table
Reference in a new issue