mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make sure SAC and OTU get recalculated after cylinder info was changed
Also fixed minor coding style issues (prevent useless code from being executed). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5c2fca2620
commit
97a1dd6830
3 changed files with 18 additions and 8 deletions
11
divelist.c
11
divelist.c
|
|
@ -335,6 +335,14 @@ static int calculate_sac(struct dive *dive)
|
|||
return sac * 1000;
|
||||
}
|
||||
|
||||
void update_cylinder_related_info(struct dive *dive)
|
||||
{
|
||||
if(dive != NULL) {
|
||||
dive->sac = calculate_sac(dive);
|
||||
dive->otu = calculate_otu(dive);
|
||||
}
|
||||
}
|
||||
|
||||
static void get_string(char **str, const char *s)
|
||||
{
|
||||
int len;
|
||||
|
|
@ -452,8 +460,7 @@ static void fill_dive_list(void)
|
|||
for (i = 0; i < dive_table.nr; i++) {
|
||||
struct dive *dive = dive_table.dives[i];
|
||||
|
||||
dive->otu = calculate_otu(dive);
|
||||
dive->sac = calculate_sac(dive);
|
||||
update_cylinder_related_info(dive);
|
||||
gtk_list_store_append(store, &iter);
|
||||
gtk_list_store_set(store, &iter,
|
||||
DIVE_INDEX, i,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue