]> git.tdb.fi Git - ext/subsurface.git/commitdiff
When editing multiple files, don't override existing equipment entries
authorDirk Hohndel <dirk@hohndel.org>
Sat, 18 Aug 2012 02:52:04 +0000 (19:52 -0700)
committerDirk Hohndel <dirk@hohndel.org>
Sat, 18 Aug 2012 02:52:04 +0000 (19:52 -0700)
This parallels the logic used for all the string entries.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
info.c

diff --git a/info.c b/info.c
index 38776487bae8b69b0fb24efe97e4641b7a628fe1..f718e85dc48b8b2242f60b11d26e8199d37fd6a9 100644 (file)
--- a/info.c
+++ b/info.c
@@ -473,12 +473,12 @@ void update_equipment_data(struct dive *dive, struct dive *master)
 {
        if (dive == master)
                return;
-       if (memcmp(remember_cyl, master->cylinder, sizeof(cylinder_t) * MAX_CYLINDERS)) {
+       if (memcmp(remember_cyl, master->cylinder, sizeof(cylinder_t) * MAX_CYLINDERS) &&
+               cylinder_none(dive->cylinder))
                memcpy(dive->cylinder, master->cylinder, sizeof(cylinder_t) * MAX_CYLINDERS);
-       }
-       if (memcmp(remember_ws, master->weightsystem, sizeof(weightsystem_t) * MAX_WEIGHTSYSTEMS)) {
+       if (memcmp(remember_ws, master->weightsystem, sizeof(weightsystem_t) * MAX_WEIGHTSYSTEMS) &&
+               weightsystem_none(dive->weightsystem))
                memcpy(dive->weightsystem, master->weightsystem, sizeof(weightsystem_t) * MAX_WEIGHTSYSTEMS);
-       }
 }
 
 int edit_multi_dive_info(int nr, int *indices)