diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java index 11c9697..54c7367 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java @@ -63,6 +63,10 @@ public class Player implements FieldVisitor{ this.handler = handler; } + public void setFigure(Figure figure) { + this.figure = figure; + } + public PlayerColor getColor() { switch ((id%6)+1) { case 1: return PlayerColor.BLUE; diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java index cd6d051..1d9bde6 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java @@ -19,6 +19,9 @@ import pp.monopoly.message.server.ServerMessage; import pp.monopoly.message.server.TradeReply; import pp.monopoly.message.server.TradeRequest; import pp.monopoly.message.server.ViewAssetsResponse; +import pp.monopoly.model.Board; +import pp.monopoly.model.Figure; +import pp.monopoly.model.Rotation; import pp.monopoly.model.fields.BoardManager; import pp.monopoly.model.fields.PropertyField; @@ -187,6 +190,8 @@ public class ServerGameLogic implements ClientInterpreter { if (player != null) { player.setName(msg.getName()); + player.setFigure(new Figure(1, -10, -10, Rotation.LEFT, msg.getFigure())); + //TODO add figure to the map playerHandler.setPlayerReady(player, true); LOGGER.log(Level.DEBUG, "Player {0} is ready", player.getName()); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Board.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Board.java index 31ee634..e46308f 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Board.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Board.java @@ -57,7 +57,6 @@ public class Board { this.width = width; this.height = height; this.eventBroker = eventBroker; - addItem(new Figure(5, 5, 5, Rotation.LEFT)); } /** diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java index 573ea38..99e6ab9 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/Figure.java @@ -8,6 +8,7 @@ import static java.lang.Math.max; import static java.lang.Math.min; public class Figure implements Item{ + private final String type; private final int length; // The length of the Figure private int x; // The x-coordinate of the Figure's position private int y; // The y-coordinate of the Figure's position @@ -19,7 +20,7 @@ public class Figure implements Item{ * at position (0, 0), with a default rotation of RIGHT. */ private Figure() { - this(0, 0, 0, Rotation.RIGHT); + this(0, 0, 0, Rotation.RIGHT, "cube"); } /** @@ -30,11 +31,12 @@ public class Figure implements Item{ * @param y the y-coordinate of the Figure's initial position * @param rot the rotation of the Figure */ - public Figure(int length, int x, int y, Rotation rot) { + public Figure(int length, int x, int y, Rotation rot, String type) { this.x = x; this.y = y; this.rot = rot; this.length = length; + this.type = type; } /**