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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
@Serializable
|
||||
public class BonusNode extends Node {
|
||||
BonusNode(){
|
||||
super();
|
||||
super(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
@Serializable
|
||||
public class HomeNode extends Node {
|
||||
public HomeNode() {
|
||||
super();
|
||||
super(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user