Settlement.java and changes SiedlerGame buildRoad Method
This commit is contained in:
parent
0db6be32b6
commit
456ea5356f
|
@ -3,11 +3,15 @@ package ch.zhaw.catan;
|
|||
import java.util.HashMap;
|
||||
|
||||
public class Road {
|
||||
HashMap<Config.Resource,Integer> buildCost;
|
||||
private HashMap<Config.Resource,Integer> buildCost;
|
||||
|
||||
public Road() {
|
||||
buildCost = new HashMap<>();
|
||||
buildCost.put(Config.Resource.BRICK,1);
|
||||
buildCost.put(Config.Resource.LUMBER,1);
|
||||
}
|
||||
|
||||
public HashMap<Config.Resource,Integer> getBuildCost() {
|
||||
return buildCost;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package ch.zhaw.catan;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Settlement {
|
||||
private HashMap<Config.Resource,Integer> buildCost;
|
||||
|
||||
public Settlement() {
|
||||
buildCost = new HashMap<>();
|
||||
buildCost.put(Config.Resource.LUMBER,1);
|
||||
buildCost.put(Config.Resource.BRICK,1);
|
||||
buildCost.put(Config.Resource.GRAIN,1);
|
||||
buildCost.put(Config.Resource.WOOL,1);
|
||||
}
|
||||
|
||||
public HashMap<Config.Resource,Integer> getBuildCost() {
|
||||
return buildCost;
|
||||
}
|
||||
|
||||
}
|
|
@ -212,7 +212,18 @@ public class SiedlerGame {
|
|||
* @return true, if the placement was successful
|
||||
*/
|
||||
public boolean buildRoad(Point roadStart, Point roadEnd) {
|
||||
// TODO: Implement
|
||||
//1. Check if Edge
|
||||
if(!board.hasEdge(roadStart,roadEnd)){
|
||||
// TODO: Error message
|
||||
}
|
||||
//2. Check if Edge is empty
|
||||
if(board.getEdge(roadStart,roadEnd) != null) {
|
||||
// TODO: Error message
|
||||
}
|
||||
//3. Can Player build road
|
||||
// TODO
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue