diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-10-02 23:03:44 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-04 08:05:09 -0700 |
commit | 21d78121ade941adf9eaad399e6b8146298b421f (patch) | |
tree | 56cc4109f116d7b667163e960fcc7936fdf4c6aa /core/dive.h | |
parent | de10fd4021f7fa7e203782df29456c09e07165e8 (diff) | |
download | subsurface-21d78121ade941adf9eaad399e6b8146298b421f.tar.gz |
Don't add separate country field, use taxonomy
The more I looked at the code that added the country to the dive site,
the more it seemed redundant given what we have with the taxonomy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/dive.h')
-rw-r--r-- | core/dive.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/dive.h b/core/dive.h index a638cfd0c..51524500f 100644 --- a/core/dive.h +++ b/core/dive.h @@ -570,11 +570,14 @@ static inline struct dive_site *get_dive_site_for_dive(struct dive *dive) return NULL; } -static inline char *get_dive_country(struct dive *dive) +static inline const char *get_dive_country(struct dive *dive) { struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid); - if (ds && ds->country) - return ds->country; + if (ds) { + int idx = taxonomy_index_for_category(&ds->taxonomy, TC_COUNTRY); + if (idx >= 0) + return ds->taxonomy.category[idx].value; + } return NULL; } |