From 685c59214df666a8a31c4a8a27191ce5003e514e Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sun, 23 Jul 2017 21:58:36 +0300 Subject: Map Divinglog's visibility to our stars good (1) = 5 medium (2) = 3 bad (3) = 1 There seems also to be 0 used in the log, even though it is not mentioned in the valid selections. This is not giving any stars for this option... Signed-off-by: Miika Turkia --- core/parse-xml.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index e6861d44d..92755bee2 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -3348,9 +3348,24 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column) if (data[11]) cur_dive->suit = strdup(data[11]); - /* TODO: check what the visibility options are in Divinglog and map them to Subsurface's 0-5 scale */ - if (data[14]) - cur_dive->visibility = atoi(data[14]); + /* Divinglog has following visibility options: good, medium, bad */ + if (data[14]) { + switch(data[14][0]) { + case '0': + break; + case '1': + cur_dive->visibility = 5; + break; + case '2': + cur_dive->visibility = 3; + break; + case '3': + cur_dive->visibility = 1; + break; + default: + break; + } + } settings_start(); dc_settings_start(); -- cgit v1.2.3-70-g09d2