Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
b23e210bb2
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -94,7 +94,22 @@ public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
|
||||||
* @return the list with the adjacent {@link Land}s
|
* @return the list with the adjacent {@link Land}s
|
||||||
*/
|
*/
|
||||||
public List<Land> getLandsForCorner(Point corner) {
|
public List<Land> getLandsForCorner(Point corner) {
|
||||||
//TODO: Implement.
|
Point above = new Point(corner.x, corner.y + 2);
|
||||||
|
Point below = new Point(corner.x, corner.y -2);
|
||||||
|
Land[] lands = new Land[3];
|
||||||
|
if (hasField(above)) {
|
||||||
|
lands[0] = getField(above);
|
||||||
|
lands[1] = getField(new Point(corner.x + 1, corner.y - 1));
|
||||||
|
lands[2] = getField(new Point(corner.x - 1, corner.y - 1));
|
||||||
|
}
|
||||||
|
else if (hasField(below)) {
|
||||||
|
lands[0] = getField(below);
|
||||||
|
lands[1] = getField(new Point(corner.x + 1, corner.y + 1));
|
||||||
|
lands[2] = getField(new Point(corner.x - 1, corner.y + 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
return Collections.unmodifiableList(Arrays.asList(lands));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import ch.zhaw.hexboard.Label;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class SiedlerBoardTextView extends HexBoardTextView<Land, String, String, String> {
|
public class SiedlerBoardTextView extends HexBoardTextView<Land, Settlement, Road, String> {
|
||||||
|
|
||||||
public SiedlerBoardTextView(SiedlerBoard board) {
|
public SiedlerBoardTextView(SiedlerBoard board) {
|
||||||
super(board);
|
super(board);
|
||||||
|
|
Loading…
Reference in New Issue