rename variables in SiedlerBoard
This commit is contained in:
parent
c910c00c38
commit
8b2b9e2882
|
@ -10,7 +10,7 @@ import java.util.*;
|
||||||
|
|
||||||
public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
||||||
|
|
||||||
Map<Point, Field> lowerFieldLabel = new HashMap<>();
|
Map<Point, Field> fields = new HashMap<>();
|
||||||
|
|
||||||
public void createFixGamefield(){
|
public void createFixGamefield(){
|
||||||
Map<Point,Land> resourcePlacement = Config.getStandardLandPlacement();
|
Map<Point,Land> resourcePlacement = Config.getStandardLandPlacement();
|
||||||
|
@ -21,10 +21,10 @@ public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
||||||
String numberAsString = dicePlacement.get(resourceField.getKey()).toString();
|
String numberAsString = dicePlacement.get(resourceField.getKey()).toString();
|
||||||
char[] numbersInChar = numberAsString.toCharArray();
|
char[] numbersInChar = numberAsString.toCharArray();
|
||||||
if (numberAsString.length() < 2) {
|
if (numberAsString.length() < 2) {
|
||||||
lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label('0', numbersInChar[0])));
|
fields.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label('0', numbersInChar[0])));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lowerFieldLabel.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label(numbersInChar[0],numbersInChar[1])));
|
fields.put(resourceField.getKey(), new Field(resourceField.getValue(), new Label(numbersInChar[0],numbersInChar[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,15 +32,15 @@ public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
||||||
|
|
||||||
|
|
||||||
private int getDiceNumber(Point field) {
|
private int getDiceNumber(Point field) {
|
||||||
Label label = lowerFieldLabel.get(field).getLabel();
|
Label label = fields.get(field).getLabel();
|
||||||
return Integer.parseInt(label.toString());
|
return Integer.parseInt(label.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getTextView () {
|
public String getTextView () {
|
||||||
SiedlerBoardTextView view = new SiedlerBoardTextView(this);
|
SiedlerBoardTextView view = new SiedlerBoardTextView(this);
|
||||||
for (Map.Entry<Point, Field> e : lowerFieldLabel.entrySet()) {
|
for (Map.Entry<Point, Field> field : fields.entrySet()) {
|
||||||
view.setLowerFieldLabel(e.getKey(), e.getValue().getLabel());
|
view.setLowerFieldLabel(field.getKey(), field.getValue().getLabel());
|
||||||
}
|
}
|
||||||
return view.toString();
|
return view.toString();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
||||||
*/
|
*/
|
||||||
public List<Point> getFieldsForDiceValue(int dice) {
|
public List<Point> getFieldsForDiceValue(int dice) {
|
||||||
ArrayList<Point> fields = new ArrayList<>();
|
ArrayList<Point> fields = new ArrayList<>();
|
||||||
for(Point field : lowerFieldLabel.keySet()){
|
for(Point field : this.fields.keySet()){
|
||||||
if(getDiceNumber(field) == dice){
|
if(getDiceNumber(field) == dice){
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue