Added superclass structure to roads and settlement

This commit is contained in:
MikeZyeman 2021-11-29 15:56:52 +01:00
parent 8fb406bea0
commit ce31d0f439
3 changed files with 12 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" 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

@ -1,19 +1,8 @@
package ch.zhaw.catan;
import java.util.HashMap;
public class Road {
private HashMap<Config.Resource,Integer> buildCost;
private Config.Faction faction;
public class Road extends Structure {
public Road(Config.Faction faction) {
this.faction = faction;
buildCost = new HashMap<>();
buildCost.put(Config.Resource.BRICK,1);
buildCost.put(Config.Resource.LUMBER,1);
}
public HashMap<Config.Resource,Integer> getBuildCost() {
return buildCost;
super(faction);
}
}

View File

@ -0,0 +1,9 @@
package ch.zhaw.catan;
public abstract class Structure {
private Config.Faction faction;
public Structure(Config.Faction faction) {
this.faction = faction;
}
}