summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-07-23 21:58:36 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-24 13:08:04 +0900
commit685c59214df666a8a31c4a8a27191ce5003e514e (patch)
treeae668e537aae48055d604fa7095b2eba3b66f074 /core
parenta7231be9a0220e343537be9d962b33b44ef397d4 (diff)
downloadsubsurface-685c59214df666a8a31c4a8a27191ce5003e514e.tar.gz
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 <miika.turkia@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/parse-xml.c21
1 files 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();