diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-02-23 11:05:19 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:34 +0200 |
commit | 2453d4fc1fa6c6109645853483839f1e3c87d4a8 (patch) | |
tree | c5555dfe98f91beed0cb99291b31e34ddb88c26c /core/equipment.c | |
parent | 64a5f10cfe9bf82bcab3efc99961bd20cf602df9 (diff) | |
download | subsurface-2453d4fc1fa6c6109645853483839f1e3c87d4a8.tar.gz |
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>
Diffstat (limited to 'core/equipment.c')
-rw-r--r-- | core/equipment.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/equipment.c b/core/equipment.c index c9c0539c3..e96ce0d6a 100644 --- a/core/equipment.c +++ b/core/equipment.c @@ -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) |