adjusted all constuctors of nodes so that if someone creates a node the piece will be null and the option for a constuctor without arguments is still given for serialization purposes

This commit is contained in:
Hanno Fleischer
2024-12-03 17:56:39 +01:00
parent 69865bb504
commit 81cb2f33ff
5 changed files with 10 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ public Board() {
} else if (i == 4 || i == 14 || i == 24 || i == 34) {
infield[i] = new BonusNode();
} else {
infield[i] = new Node();
infield[i] = new Node(null);
}
}
}

View File

@@ -8,6 +8,6 @@
@Serializable
public class BonusNode extends Node {
BonusNode(){
super();
super(null);
}
}

View File

@@ -8,6 +8,6 @@
@Serializable
public class HomeNode extends Node {
public HomeNode() {
super();
super(null);
}
}

View File

@@ -9,7 +9,11 @@
public class Node {
protected Piece occupant;
public Node(){
public Node(Piece piece){
occupant = piece;
}
private Node(){
occupant = new Piece(Color.AIRFORCE, PieceState.WAITING);
}

View File

@@ -18,10 +18,12 @@ public class StartNode extends Node {
* @param color the color of the node
*/
public StartNode(Color color) {
super(null);
this.color = color;
}
private StartNode() {
super(null);
color = Color.NONE;
}