bug5918: adding testcase nowind and nowaypoint, changing null check from windbearing to wind

This commit is contained in:
Lisa
2023-12-01 09:13:44 +01:00
parent 5d19e414c5
commit 412e6b989a
2 changed files with 38 additions and 15 deletions
@@ -1259,10 +1259,11 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
// TODO: missing solution for cases with PassingInstruction Offset and FixedBearing
final Position waypointPosition = cache.getApproximatePosition(getTrackedRace(), getLeg().getTo(),
timePoint);
final Bearing bearingWind = cache.getWind(getTrackedRace(), competitor, timePoint).getFrom();
final Wind wind = cache.getWind(getTrackedRace(), competitor, timePoint);
final Position competitorPosition = getTrackedRace().getTrack(competitor).getEstimatedPosition(timePoint,
/* extrapolate */ true);
if (waypointPosition != null && bearingWind != null && competitorPosition != null) {
if (waypointPosition != null && wind != null && competitorPosition != null) {
final Bearing bearingWind = wind.getFrom();
final Bearing cog = getSpeedOverGround(timePoint).getBearing();
final Bearing bearingToWaypoint = competitorPosition.getBearingGreatCircle(waypointPosition);
final Bearing diffWindToBoat = bearingWind.getDifferenceTo(cog).abs();