mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move dive-site functions into class
In analogy to the previous commit for dive-site-table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
76c52c87a3
commit
2de6f69c19
20 changed files with 69 additions and 71 deletions
|
@ -559,7 +559,7 @@ static void dive_site(const char *buffer, struct dive *d, struct parser_state *s
|
|||
{
|
||||
uint32_t uuid;
|
||||
hex_value(buffer, &uuid);
|
||||
add_dive_to_dive_site(d, state->log->sites->get_by_uuid(uuid));
|
||||
state->log->sites->get_by_uuid(uuid)->add_dive(d);
|
||||
}
|
||||
|
||||
static void get_notrip(const char *buffer, bool *notrip)
|
||||
|
@ -980,7 +980,7 @@ static void divinglog_place(const char *place, struct dive *d, struct parser_sta
|
|||
ds = state->log->sites->get_by_name(buffer);
|
||||
if (!ds)
|
||||
ds = state->log->sites->create(buffer);
|
||||
add_dive_to_dive_site(d, ds);
|
||||
ds->add_dive(d);
|
||||
|
||||
// TODO: capture the country / city info in the taxonomy instead
|
||||
state->city.clear();
|
||||
|
@ -1149,7 +1149,7 @@ static void gps_lat(const char *buffer, struct dive *dive, struct parser_state *
|
|||
|
||||
location.lat = parse_degrees(buffer, &end);
|
||||
if (!ds) {
|
||||
add_dive_to_dive_site(dive, state->log->sites->create(std::string(), &location));
|
||||
state->log->sites->create(std::string(), &location)->add_dive(dive);
|
||||
} else {
|
||||
if (ds->location.lat.udeg && ds->location.lat.udeg != location.lat.udeg)
|
||||
report_info("Oops, changing the latitude of existing dive site id %8x name %s; not good", ds->uuid,
|
||||
|
@ -1166,7 +1166,7 @@ static void gps_long(const char *buffer, struct dive *dive, struct parser_state
|
|||
|
||||
location.lon = parse_degrees(buffer, &end);
|
||||
if (!ds) {
|
||||
add_dive_to_dive_site(dive, state->log->sites->create(std::string(), &location));
|
||||
state->log->sites->create(std::string(), &location)->add_dive(dive);
|
||||
} else {
|
||||
if (ds->location.lon.udeg && ds->location.lon.udeg != location.lon.udeg)
|
||||
report_info("Oops, changing the longitude of existing dive site id %8x name %s; not good", ds->uuid,
|
||||
|
@ -1206,7 +1206,7 @@ static void gps_in_dive(const char *buffer, struct dive *dive, struct parser_sta
|
|||
} else {
|
||||
ds = state->log->sites->create(std::string(), &location);
|
||||
}
|
||||
add_dive_to_dive_site(dive, ds);
|
||||
ds->add_dive(dive);
|
||||
} else {
|
||||
if (dive_site_has_gps_location(ds) &&
|
||||
has_location(&location) && ds->location != location) {
|
||||
|
@ -2225,7 +2225,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divelog *log)
|
|||
/* Measure GPS */
|
||||
state.cur_location.lat.udeg = (int)((ptr[7] << 24) + (ptr[6] << 16) + (ptr[5] << 8) + (ptr[4] << 0));
|
||||
state.cur_location.lon.udeg = (int)((ptr[11] << 24) + (ptr[10] << 16) + (ptr[9] << 8) + (ptr[8] << 0));
|
||||
add_dive_to_dive_site(state.cur_dive, state.log->sites->create("DLF imported"s, &state.cur_location));
|
||||
state.log->sites->create("DLF imported"s, &state.cur_location)->add_dive(state.cur_dive);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue