bug6276: negative vmgs bug

This commit is contained in:
Masha Kashirina
2026-07-30 12:37:49 +02:00
parent 123ed3c655
commit 693d05f5a1
@@ -311,14 +311,15 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
if (speed != null) {
Bearing projectToBearing;
try {
if (cache.getLegType(getTrackedLeg(), at) != LegType.REACHING) {
final LegType legType = cache.getLegType(getTrackedLeg(), at);
if (legType != LegType.REACHING) {
final Wind wind = getTrackedRace().getWind(windPositionMode, getTrackedLeg(), getCompetitor(), at, cache);
if (wind == null) {
// This is not really likely to happen because wind==null would have let the call
// to cache.getLegType(...) fail with a NoWindException
throw new NoWindException("Need at least wind direction to determine windward speed");
}
projectToBearing = wind.getBearing();
projectToBearing = legType == LegType.UPWIND ? wind.getFrom() : wind.getBearing();
} else {
projectToBearing = cache.getLegBearing(getTrackedLeg(), at);
}