mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: remove accessor get_dive_site_for_dive()
This function does nothing at all, callers may just access dive::dive_site directly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
718523e01d
commit
731052c776
10 changed files with 11 additions and 17 deletions
|
@ -2496,11 +2496,6 @@ depth_t dive::gas_mnd(struct gasmix mix, depth_t end, int roundto) const
|
||||||
return depth_t { (int)lrint(((double)mbar_to_depth(maxambient)) / roundto) * roundto };
|
return depth_t { (int)lrint(((double)mbar_to_depth(maxambient)) / roundto) * roundto };
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dive_site *get_dive_site_for_dive(const struct dive *dive)
|
|
||||||
{
|
|
||||||
return dive->dive_site;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string get_dive_country(const struct dive *dive)
|
std::string get_dive_country(const struct dive *dive)
|
||||||
{
|
{
|
||||||
struct dive_site *ds = dive->dive_site;
|
struct dive_site *ds = dive->dive_site;
|
||||||
|
|
|
@ -160,7 +160,6 @@ struct dive_components {
|
||||||
extern fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner);
|
extern fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner);
|
||||||
extern fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2);
|
extern fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2);
|
||||||
|
|
||||||
extern struct dive_site *get_dive_site_for_dive(const struct dive *dive);
|
|
||||||
extern std::string get_dive_country(const struct dive *dive);
|
extern std::string get_dive_country(const struct dive *dive);
|
||||||
extern std::string get_dive_location(const struct dive *dive);
|
extern std::string get_dive_location(const struct dive *dive);
|
||||||
extern struct divecomputer *get_dive_dc(struct dive *dive, int nr);
|
extern struct divecomputer *get_dive_dc(struct dive *dive, int nr);
|
||||||
|
|
|
@ -172,7 +172,7 @@ static int get_hex(const char *line)
|
||||||
static void parse_dive_gps(char *line, struct git_parser_state *state)
|
static void parse_dive_gps(char *line, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
location_t location;
|
location_t location;
|
||||||
struct dive_site *ds = get_dive_site_for_dive(state->active_dive.get());
|
struct dive_site *ds = state->active_dive->dive_site;
|
||||||
|
|
||||||
parse_location(line, &location);
|
parse_location(line, &location);
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
|
@ -211,7 +211,7 @@ static std::string get_first_converted_string(struct git_parser_state *state)
|
||||||
static void parse_dive_location(char *, struct git_parser_state *state)
|
static void parse_dive_location(char *, struct git_parser_state *state)
|
||||||
{
|
{
|
||||||
std::string name = get_first_converted_string(state);
|
std::string name = get_first_converted_string(state);
|
||||||
struct dive_site *ds = get_dive_site_for_dive(state->active_dive.get());
|
struct dive_site *ds = state->active_dive->dive_site;
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
ds = state->log->sites.get_by_name(name);
|
ds = state->log->sites.get_by_name(name);
|
||||||
if (!ds)
|
if (!ds)
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ static void gps_lat(const char *buffer, struct dive *dive, struct parser_state *
|
||||||
{
|
{
|
||||||
const char *end;
|
const char *end;
|
||||||
location_t location = { };
|
location_t location = { };
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive);
|
struct dive_site *ds = dive->dive_site;
|
||||||
|
|
||||||
location.lat = parse_degrees(buffer, &end);
|
location.lat = parse_degrees(buffer, &end);
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
|
@ -1161,7 +1161,7 @@ static void gps_long(const char *buffer, struct dive *dive, struct parser_state
|
||||||
{
|
{
|
||||||
const char *end;
|
const char *end;
|
||||||
location_t location = { };
|
location_t location = { };
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive);
|
struct dive_site *ds = dive->dive_site;
|
||||||
|
|
||||||
location.lon = parse_degrees(buffer, &end);
|
location.lon = parse_degrees(buffer, &end);
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
|
|
|
@ -190,7 +190,7 @@ static void put_HTML_samples(struct membuffer *b, const struct dive &dive)
|
||||||
|
|
||||||
static void put_HTML_coordinates(struct membuffer *b, const struct dive &dive)
|
static void put_HTML_coordinates(struct membuffer *b, const struct dive &dive)
|
||||||
{
|
{
|
||||||
struct dive_site *ds = get_dive_site_for_dive(&dive);
|
struct dive_site *ds = dive.dive_site;
|
||||||
if (!ds)
|
if (!ds)
|
||||||
return;
|
return;
|
||||||
degrees_t latitude = ds->location.lat;
|
degrees_t latitude = ds->location.lat;
|
||||||
|
|
|
@ -35,7 +35,7 @@ static void writeMarkers(struct membuffer *b, bool selected_only)
|
||||||
for (auto &dive: divelog.dives) {
|
for (auto &dive: divelog.dives) {
|
||||||
if (selected_only && !dive->selected)
|
if (selected_only && !dive->selected)
|
||||||
continue;
|
continue;
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive.get());
|
struct dive_site *ds = dive->dive_site;
|
||||||
if (!ds || !ds->has_gps_location())
|
if (!ds || !ds->has_gps_location())
|
||||||
continue;
|
continue;
|
||||||
put_degrees(b, ds->location.lat, "temp = new google.maps.Marker({position: new google.maps.LatLng(", "");
|
put_degrees(b, ds->location.lat, "temp = new google.maps.Marker({position: new google.maps.LatLng(", "");
|
||||||
|
|
|
@ -666,7 +666,7 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
|
||||||
{
|
{
|
||||||
location_t currentLocation;
|
location_t currentLocation;
|
||||||
if (d) {
|
if (d) {
|
||||||
currDs = get_dive_site_for_dive(d);
|
currDs = d->dive_site;
|
||||||
currentLocation = d->get_gps_location();
|
currentLocation = d->get_gps_location();
|
||||||
} else {
|
} else {
|
||||||
currDs = nullptr;
|
currDs = nullptr;
|
||||||
|
|
|
@ -286,7 +286,7 @@ void MainWindow::editDiveSite(dive_site *ds)
|
||||||
void MainWindow::startDiveSiteEdit()
|
void MainWindow::startDiveSiteEdit()
|
||||||
{
|
{
|
||||||
if (current_dive)
|
if (current_dive)
|
||||||
editDiveSite(get_dive_site_for_dive(current_dive));
|
editDiveSite(current_dive->dive_site);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enableDisableCloudActions()
|
void MainWindow::enableDisableCloudActions()
|
||||||
|
|
|
@ -135,7 +135,7 @@ void MapWidgetHelper::selectedLocationChanged(struct dive_site *ds_in)
|
||||||
QGeoCoordinate locationCoord = location->coordinate;
|
QGeoCoordinate locationCoord = location->coordinate;
|
||||||
|
|
||||||
for (auto [idx, dive]: enumerated_range(divelog.dives)) {
|
for (auto [idx, dive]: enumerated_range(divelog.dives)) {
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive.get());
|
struct dive_site *ds = dive->dive_site;
|
||||||
if (!ds || !ds->has_gps_location())
|
if (!ds || !ds->has_gps_location())
|
||||||
continue;
|
continue;
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
@ -163,7 +163,7 @@ void MapWidgetHelper::selectVisibleLocations()
|
||||||
{
|
{
|
||||||
QList<int> selectedDiveIds;
|
QList<int> selectedDiveIds;
|
||||||
for (auto [idx, dive]: enumerated_range(divelog.dives)) {
|
for (auto [idx, dive]: enumerated_range(divelog.dives)) {
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive.get());
|
struct dive_site *ds = dive->dive_site;
|
||||||
if (!ds || ds->has_gps_location())
|
if (!ds || ds->has_gps_location())
|
||||||
continue;
|
continue;
|
||||||
const qreal latitude = ds->location.lat.udeg * 0.000001;
|
const qreal latitude = ds->location.lat.udeg * 0.000001;
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ parsed:
|
||||||
|
|
||||||
bool QMLManager::checkLocation(DiveSiteChange &res, struct dive *d, QString location, QString gps)
|
bool QMLManager::checkLocation(DiveSiteChange &res, struct dive *d, QString location, QString gps)
|
||||||
{
|
{
|
||||||
struct dive_site *ds = get_dive_site_for_dive(d);
|
struct dive_site *ds = d->dive_site;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
QString oldLocation = QString::fromStdString(get_dive_location(d));
|
QString oldLocation = QString::fromStdString(get_dive_location(d));
|
||||||
if (oldLocation != location) {
|
if (oldLocation != location) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue