mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-26 18:48:30 -04:00
AP_Rally: replace location_offset() and get_distance() function calls with Location object member function calls
This allows removing duplicated code
This commit is contained in:
parent
12a6e9ad69
commit
00a80f3a1a
@ -126,7 +126,7 @@ bool AP_Rally::find_nearest_rally_point(const Location ¤t_loc, RallyLocati
|
||||
continue;
|
||||
}
|
||||
Location rally_loc = rally_location_to_location(next_rally);
|
||||
float dis = get_distance(current_loc, rally_loc);
|
||||
float dis = current_loc.get_distance(rally_loc);
|
||||
|
||||
if (is_valid(rally_loc) && (dis < min_dis || min_dis < 0)) {
|
||||
min_dis = dis;
|
||||
@ -158,7 +158,7 @@ Location AP_Rally::calc_best_rally_or_home_location(const Location ¤t_loc,
|
||||
if (find_nearest_rally_point(current_loc, ral_loc)) {
|
||||
Location loc = rally_location_to_location(ral_loc);
|
||||
// use the rally point if it's closer then home, or we aren't generally considering home as acceptable
|
||||
if (!_rally_incl_home || (get_distance(current_loc, loc) < get_distance(current_loc, return_loc))) {
|
||||
if (!_rally_incl_home || (current_loc.get_distance(loc) < current_loc.get_distance(return_loc))) {
|
||||
return_loc = rally_location_to_location(ral_loc);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user