Merge branch 'master' into storyD-3D
This commit is contained in:
@@ -32,7 +32,7 @@ public class NewPolars {
|
|||||||
public static void addPolars(double trueWindSpeed, Bearing trueWindAngle, double boatSpeed){
|
public static void addPolars(double trueWindSpeed, Bearing trueWindAngle, double boatSpeed){
|
||||||
double tws = trueWindSpeed;
|
double tws = trueWindSpeed;
|
||||||
double bs = boatSpeed;
|
double bs = boatSpeed;
|
||||||
double twa = trueWindAngle.degrees();
|
double twa = trueWindAngle.degrees() + 180;
|
||||||
if (!polars.containsKey(tws)){
|
if (!polars.containsKey(tws)){
|
||||||
polars.put(tws, new TreeMap<>());
|
polars.put(tws, new TreeMap<>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,14 @@ public class CommandFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(action.getBoatAction()) {
|
switch(action.getBoatAction()) {
|
||||||
case AUTO_PILOT: return new VMGCommand(race, boat);
|
case VMG: return new VMGCommand(race, boat);
|
||||||
case TACK_GYBE: return new TackGybeCommand(race, boat);
|
case TACK_GYBE: return new TackGybeCommand(race, boat);
|
||||||
case UPWIND: return new WindCommand(race, boat, true);
|
case UPWIND: return new WindCommand(race, boat, true);
|
||||||
case DOWNWIND: return new WindCommand(race, boat, false);
|
case DOWNWIND: return new WindCommand(race, boat, false);
|
||||||
case SAILS_OUT: return new SailsCommand(race, boat, true);
|
case SAILS_OUT: return new SailsCommand(race, boat, true);
|
||||||
case SAILS_IN: return new SailsCommand(race, boat, false);
|
case SAILS_IN: return new SailsCommand(race, boat, false);
|
||||||
|
case ZOOM_IN: return null;
|
||||||
|
case ZOOM_OUT: return null;
|
||||||
|
|
||||||
default: throw new CommandConstructionException("Could not create command for BoatAction: " + action + ". Unknown BoatAction.");
|
default: throw new CommandConstructionException("Could not create command for BoatAction: " + action + ". Unknown BoatAction.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ public enum BoatActionEnum {
|
|||||||
/**
|
/**
|
||||||
* Autopilot = auto VMG.
|
* Autopilot = auto VMG.
|
||||||
*/
|
*/
|
||||||
AUTO_PILOT(1),
|
VMG(1),
|
||||||
SAILS_IN(2),
|
SAILS_IN(2),
|
||||||
SAILS_OUT(3),
|
SAILS_OUT(3),
|
||||||
TACK_GYBE(4),
|
TACK_GYBE(4),
|
||||||
UPWIND(5),
|
UPWIND(5),
|
||||||
DOWNWIND(6);
|
DOWNWIND(6),
|
||||||
|
ZOOM_IN(7),
|
||||||
|
ZOOM_OUT(8),
|
||||||
|
TOGGLE_SAILS(9);
|
||||||
|
|
||||||
private byte value;
|
private byte value;
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ public class HostGameController extends Controller {
|
|||||||
*/
|
*/
|
||||||
public void alertMatchBrowser(){
|
public void alertMatchBrowser(){
|
||||||
try{
|
try{
|
||||||
|
if (matchBrowserInterface == null){
|
||||||
|
return;//private game
|
||||||
|
}
|
||||||
matchBrowserInterface.startSendingHostData(App.game.getHostedGameData(), udpSocket);
|
matchBrowserInterface.startSendingHostData(App.game.getHostedGameData(), udpSocket);
|
||||||
}catch (IOException e){
|
}catch (IOException e){
|
||||||
System.err.println("failed to send out hosted game info");
|
System.err.println("failed to send out hosted game info");
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ public class InGameLobbyController extends Controller {
|
|||||||
* @param interval Countdown interval to check
|
* @param interval Countdown interval to check
|
||||||
*/
|
*/
|
||||||
private void countdownText(long interval){
|
private void countdownText(long interval){
|
||||||
|
countdownTenPane.setVisible(false);
|
||||||
//Do nothing if 5 seconds or less to go
|
//Do nothing if 5 seconds or less to go
|
||||||
if (interval <=5000){
|
if (interval <=5000){
|
||||||
countdownTenPane.setVisible(false);
|
countdownTenPane.setVisible(false);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public enum TutorialState {
|
|||||||
/**
|
/**
|
||||||
* State for vmg in tutorial
|
* State for vmg in tutorial
|
||||||
*/
|
*/
|
||||||
VMG(BoatActionEnum.AUTO_PILOT),
|
VMG(BoatActionEnum.VMG),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State for sails-in in tutorial
|
* State for sails-in in tutorial
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class SailsToggleKey extends ControlKey {
|
|||||||
* Constructor for Control
|
* Constructor for Control
|
||||||
*/
|
*/
|
||||||
public SailsToggleKey() {
|
public SailsToggleKey() {
|
||||||
super("Toggle Sails", BoatActionEnum.NOT_A_STATUS);
|
super("Toggle Sails", BoatActionEnum.TOGGLE_SAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class VMGKey extends ControlKey{
|
|||||||
* Constructor for Control
|
* Constructor for Control
|
||||||
*/
|
*/
|
||||||
public VMGKey() {
|
public VMGKey() {
|
||||||
super("VMG", BoatActionEnum.AUTO_PILOT);
|
super("VMG", BoatActionEnum.VMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package visualiser.gameController.Keys;
|
package visualiser.gameController.Keys;
|
||||||
|
|
||||||
|
import network.Messages.Enums.BoatActionEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key to zoom into the game
|
* key to zoom into the game
|
||||||
*/
|
*/
|
||||||
public class ZoomInKey extends ControlKey {
|
public class ZoomInKey extends ControlKey {
|
||||||
|
|
||||||
public ZoomInKey() {
|
public ZoomInKey() {
|
||||||
super("Zoom In");
|
super("Zoom In", BoatActionEnum.ZOOM_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package visualiser.gameController.Keys;
|
package visualiser.gameController.Keys;
|
||||||
|
|
||||||
|
import network.Messages.Enums.BoatActionEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key to zoom out of the game.
|
* Key to zoom out of the game.
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +11,7 @@ public class ZoomOutKey extends ControlKey{
|
|||||||
* Constructor for Control
|
* Constructor for Control
|
||||||
*/
|
*/
|
||||||
public ZoomOutKey() {
|
public ZoomOutKey() {
|
||||||
super("Zoom Out");
|
super("Zoom Out", BoatActionEnum.ZOOM_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import network.Exceptions.InvalidMessageException;
|
|||||||
import network.MessageEncoders.RaceVisionByteEncoder;
|
import network.MessageEncoders.RaceVisionByteEncoder;
|
||||||
import network.Messages.BoatAction;
|
import network.Messages.BoatAction;
|
||||||
import network.Messages.Enums.BoatActionEnum;
|
import network.Messages.Enums.BoatActionEnum;
|
||||||
import network.Messages.Enums.RequestToJoinEnum;
|
|
||||||
import network.Messages.RequestToJoin;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -65,7 +63,7 @@ public class BoatActionDecoderTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void autoPilotTest() throws Exception {
|
public void autoPilotTest() throws Exception {
|
||||||
boatActionTypeTest(BoatActionEnum.AUTO_PILOT);
|
boatActionTypeTest(BoatActionEnum.VMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user