diff options
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/divelist.c b/divelist.c index 1e279efca..cccd3a0a6 100644 --- a/divelist.c +++ b/divelist.c @@ -434,14 +434,14 @@ void update_cylinder_related_info(struct dive *dive) } } -#define MAX_NITROX_STRING 80 +#define MAX_GAS_STRING 80 #define UTF8_ELLIPSIS "\xE2\x80\xA6" /* callers needs to free the string */ -char *get_nitrox_string(struct dive *dive) +char *get_dive_gas_string(struct dive *dive) { int o2, he, o2low; - char *buffer = malloc(MAX_NITROX_STRING); + char *buffer = malloc(MAX_GAS_STRING); if (buffer) { get_dive_gas(dive, &o2, &he, &o2low); @@ -450,12 +450,12 @@ char *get_nitrox_string(struct dive *dive) o2low = (o2low + 5) / 10; if (he) - snprintf(buffer, MAX_NITROX_STRING, "%d/%d", o2, he); + snprintf(buffer, MAX_GAS_STRING, "%d/%d", o2, he); else if (o2) if (o2 == o2low) - snprintf(buffer, MAX_NITROX_STRING, "%d", o2); + snprintf(buffer, MAX_GAS_STRING, "%d%%", o2); else - snprintf(buffer, MAX_NITROX_STRING, "%d" UTF8_ELLIPSIS "%d", o2low, o2); + snprintf(buffer, MAX_GAS_STRING, "%d" UTF8_ELLIPSIS "%d%%", o2low, o2); else strcpy(buffer, translate("gettextFromC", "air")); } @@ -1040,3 +1040,11 @@ void process_dives(bool is_imported, bool prefer_imported) mark_divelist_changed(true); } } + +void set_dive_nr_for_current_dive() +{ + if (dive_table.nr == 1) + current_dive->number = 1; + else if (selected_dive == dive_table.nr - 1 && get_dive(dive_table.nr - 2)->number) + current_dive->number = get_dive(dive_table.nr - 2)->number + 1; +} |