diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/equipment.c | 9 | ||||
-rw-r--r-- | core/equipment.h | 1 | ||||
-rw-r--r-- | core/subsurface-qt/DiveListNotifier.h | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/core/equipment.c b/core/equipment.c index e7ac327fd..07e468c1c 100644 --- a/core/equipment.c +++ b/core/equipment.c @@ -288,6 +288,15 @@ void remove_weightsystem(struct dive *dive, int idx) remove_from_weightsystem_table(&dive->weightsystems, idx); } +// ws is cloned. +void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws) +{ + if (idx < 0 || idx >= dive->weightsystems.nr) + return; + free_weightsystem(dive->weightsystems.weightsystems[idx]); + dive->weightsystems.weightsystems[idx] = clone_weightsystem(ws); +} + /* when planning a dive we need to make sure that all cylinders have a sane depth assigned * and if we are tracking gas consumption the pressures need to be reset to start = end = workingpressure */ void reset_cylinders(struct dive *dive, bool track_gas) diff --git a/core/equipment.h b/core/equipment.h index 77fd9c430..11d6f37c1 100644 --- a/core/equipment.h +++ b/core/equipment.h @@ -83,6 +83,7 @@ extern bool same_weightsystem(weightsystem_t w1, weightsystem_t w2); extern bool same_cylinder(cylinder_t cyl1, cylinder_t cyl2); extern void remove_cylinder(struct dive *dive, int idx); extern void remove_weightsystem(struct dive *dive, int idx); +extern void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws); extern void reset_cylinders(struct dive *dive, bool track_gas); extern int gas_volume(const cylinder_t *cyl, pressure_t p); /* Volume in mliter of a cylinder at pressure 'p' */ extern int find_best_gasmix_match(struct gasmix mix, const struct cylinder_table *cylinders); diff --git a/core/subsurface-qt/DiveListNotifier.h b/core/subsurface-qt/DiveListNotifier.h index 8c681948e..fc7115a99 100644 --- a/core/subsurface-qt/DiveListNotifier.h +++ b/core/subsurface-qt/DiveListNotifier.h @@ -88,6 +88,7 @@ signals: void weightsystemsReset(const QVector<dive *> &dives); void weightAdded(dive *d, int pos); void weightRemoved(dive *d, int pos); + void weightEdited(dive *d, int pos); // Trip edited signal void tripChanged(dive_trip *trip, TripField field); |