Fixed Annotations and bound windarrow
- Wind arrow for the bermuda race is bound between 215 and 235 degrees - annotations will not correctly highlight what they are showing #story[877] story[882]
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package seng302.Networking.Messages;
|
||||
|
||||
import seng302.Networking.Messages.Enums.MessageType;
|
||||
import seng302.Networking.Utils.AC35UnitConverter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -18,7 +19,6 @@ public class RaceStatus extends AC35Data {
|
||||
private int windSpeed;
|
||||
private int raceType;
|
||||
private List<BoatStatus> boatStatuses;
|
||||
private static final double windDirectionScalar = 360.0 / 32768.0; // 0x8000 / 360
|
||||
|
||||
public RaceStatus(long currentTime, int raceID, int raceStatus, long expectedStartTime, int windDirection, int windSpeed, int raceType, List<BoatStatus> boatStatuses){
|
||||
super(MessageType.RACESTATUS);
|
||||
@@ -29,7 +29,7 @@ public class RaceStatus extends AC35Data {
|
||||
this.windDirection = windDirection;
|
||||
this.windSpeed = windSpeed;
|
||||
this.raceType = raceType;
|
||||
this.boatStatuses = boatStatuses;//note this is a copy so any alterations to the parent will affect this.
|
||||
this.boatStatuses = boatStatuses;//note this is not a copy so any alterations to the parent will affect this.
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,6 @@ public class RaceStatus extends AC35Data {
|
||||
}
|
||||
|
||||
public double getScaledWindDirection() {
|
||||
return (double) windDirection * windDirectionScalar;
|
||||
return (double) AC35UnitConverter.convertHeading(windDirection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,23 @@ public class AC35UnitConverter {
|
||||
return (double) value * 360.0/65536.0;//2^15
|
||||
}
|
||||
|
||||
public static double convertHeading(int value){
|
||||
return (double) value * 360.0/65536.0;//2^15
|
||||
}
|
||||
|
||||
|
||||
public static double convertHeading(double value){
|
||||
return value * 360.0/65536.0;//2^15
|
||||
}
|
||||
|
||||
public static int encodeHeading(int value){
|
||||
return (int) (value / 360.0 * 65536.0);//2^15
|
||||
}
|
||||
|
||||
public static int encodeHeading(double value){
|
||||
return (int) (value / 360.0 * 65536.0);//2^15
|
||||
}
|
||||
|
||||
public static double convertTrueWindAngle(long value){
|
||||
return (double) value * 180.0/32768.0;//-2^15 to 2^15
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user