cheaks if all player are dead and then exits game

This commit is contained in:
Tobydrama 2020-04-20 18:48:53 +02:00
parent fd7a0f5bc3
commit 4fe0439297
2 changed files with 6 additions and 1 deletions

View File

@ -306,6 +306,11 @@ public class RoboRallyGame implements DrawableGame, InteractableGame {
if (host) { if (host) {
server.setDeadPlayers(gameBoard.getRealDeadRobots()); server.setDeadPlayers(gameBoard.getRealDeadRobots());
} }
playerList.removeIf((player) -> gameBoard.getRealDeadRobots().contains(player.getRobotID()));
if(playerList.isEmpty()){
System.exit(1);
}
} }
/** /**

View File

@ -68,5 +68,5 @@ public class RobotTest {
testRobot.setLastFlagVisited(nextFlag); testRobot.setLastFlagVisited(nextFlag);
assertEquals(1, testRobot.getLastFlagVisited()); assertEquals(1, testRobot.getLastFlagVisited());
} }
} }