Minor bug fixes.

Server will now only save incoming connections if in lobbying mode as it should
Commented out boat status printing

tags: #story[1047]
This commit is contained in:
Michael Rausch
2017-07-27 14:15:55 +12:00
parent 1d9dd76356
commit 3fe984879b
2 changed files with 14 additions and 8 deletions
@@ -136,13 +136,7 @@ public class GameState implements Runnable {
break;
}
System.out.println("-----------------------");
System.out.println("Sails are in: " + playerYacht.getSailIn());
System.out.println("Heading: " + playerYacht.getHeading());
System.out.println("Velocity: " + playerYacht.getVelocityMMS() / 1000);
System.out.println("Lat: " + playerYacht.getLocation().getLat());
System.out.println("Lng: " + playerYacht.getLocation().getLng());
System.out.println("-----------------------\n");
// printBoatStatus(playerYacht);
}
public static void update() {
@@ -186,4 +180,14 @@ public class GameState implements Runnable {
}
}
}
private static void printBoatStatus(Yacht playerYacht) {
System.out.println("-----------------------");
System.out.println("Sails are in: " + playerYacht.getSailIn());
System.out.println("Heading: " + playerYacht.getHeading());
System.out.println("Velocity: " + playerYacht.getVelocityMMS() / 1000);
System.out.println("Lat: " + playerYacht.getLocation().getLat());
System.out.println("Lng: " + playerYacht.getLocation().getLng());
System.out.println("-----------------------\n");
}
}
@@ -27,9 +27,11 @@ public class ServerListenThread extends Thread{
private void acceptConnection() {
try {
Socket thisClient = serverSocket.accept();
if (thisClient != null){
if (thisClient != null && GameState.getCurrentStage().equals(GameStages.LOBBYING)) {
ServerToClientThread thisConnection = new ServerToClientThread(thisClient);
delegate.clientConnected(thisConnection);
} else {
thisClient.close();
}
} catch (IOException e) {
e.getMessage();