changed Datatype of Road and Settlement in SiedlerBoard

This commit is contained in:
schrom01 2021-11-26 11:25:56 +01:00
parent ef484a31ea
commit 3adec5bd43
10 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -15,15 +15,14 @@ public class Dummy {
SHOW, QUIT
}
private void run() {
TextIO textIO = TextIoFactory.getTextIO();
TextTerminal<?> textTerminal = textIO.getTextTerminal();
SiedlerBoard board = new SiedlerBoard();
board.addField(new Point(2, 2), Land.FOREST);
board.setCorner(new Point(3, 3), "RR");
board.setEdge(new Point(2, 0), new Point(3, 1), "r");
board.setCorner(new Point(3, 3), new Settlement(Config.Faction.RED));
board.setEdge(new Point(2, 0), new Point(3, 1), new Road(Config.Faction.BLUE));
board.addFieldAnnotation(new Point(2, 2), new Point(3, 1), "AA");
Map<Point, Label> lowerFieldLabel = new HashMap<>();

View File

@ -4,8 +4,10 @@ import java.util.HashMap;
public class Road {
private HashMap<Config.Resource,Integer> buildCost;
private Config.Faction faction;
public Road() {
public Road(Config.Faction faction) {
this.faction = faction;
buildCost = new HashMap<>();
buildCost.put(Config.Resource.BRICK,1);
buildCost.put(Config.Resource.LUMBER,1);

View File

@ -4,8 +4,10 @@ import java.util.HashMap;
public class Settlement {
private HashMap<Config.Resource,Integer> buildCost;
private Config.Faction faction;
public Settlement() {
public Settlement(Config.Faction faction) {
this.faction = faction;
buildCost = new HashMap<>();
buildCost.put(Config.Resource.LUMBER,1);
buildCost.put(Config.Resource.BRICK,1);

View File

@ -8,7 +8,7 @@ import java.awt.*;
import java.util.*;
import java.util.List;
public class SiedlerBoard extends HexBoard<Land, String, String, String> {
public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
Map<Point, ch.zhaw.hexboard.Label> lowerFieldLabel = new HashMap<>();