From 208cf0332d7ddbecf2e3a5ecb4aedce3f1b65ee9 Mon Sep 17 00:00:00 2001 From: Steinar Aalstad Lillesund Date: Mon, 6 Apr 2020 16:14:53 +0200 Subject: [PATCH] La til en liste for players slik vi kan gi den videre til gamet. --- .../fiasko/roborally/objects/RoboRallyGame.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java b/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java index 75a1414..f24797c 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java +++ b/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java @@ -31,8 +31,9 @@ public class RoboRallyGame implements IDrawableGame { * Instantiates a new robo rally game * @param debug Whether to start the game in debugging mode */ - public RoboRallyGame(boolean debug) { + public RoboRallyGame(List playerList, boolean debug) { this.host=false; + this.playerList = playerList; if (debug) { initializeDebugMode(); } else { @@ -43,8 +44,9 @@ public class RoboRallyGame implements IDrawableGame { /** * Instantiates a new robo rally game */ - public RoboRallyGame() { + public RoboRallyGame(List playerList) { this.host=false; + this.playerList = playerList; initializeGame(); } @@ -146,15 +148,6 @@ public class RoboRallyGame implements IDrawableGame { * @throws IOException If interrupted while trying to sleep */ private void initializePlayers() throws IOException { - playerList = new ArrayList<>(); - playerList.add(new Player(RobotID.ROBOT_1, "Player1")); - playerList.add(new Player(RobotID.ROBOT_2, "Player2")); - playerList.add(new Player(RobotID.ROBOT_3, "Player3")); - playerList.add(new Player(RobotID.ROBOT_4, "Player4")); - playerList.add(new Player(RobotID.ROBOT_5, "Player5")); - playerList.add(new Player(RobotID.ROBOT_6, "Player6")); - playerList.add(new Player(RobotID.ROBOT_7, "Player7")); - playerList.add(new Player(RobotID.ROBOT_8, "Player8")); Deck cards = DeckLoaderUtil.loadProgrammingCardsDeck(); for (Player player : playerList) { cards.shuffle();