Merge remote-tracking branch 'origin/main'

This commit is contained in:
Andrin Fassbind 2021-11-26 12:15:30 +01:00
commit b23e210bb2
3 changed files with 19 additions and 4 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

@ -94,7 +94,22 @@ public class SiedlerBoard extends HexBoard<Land, Settlement, Road, String> {
* @return the list with the adjacent {@link Land}s
*/
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.unmodifiableList(Arrays.asList(lands));
}
}

View File

@ -6,7 +6,7 @@ import ch.zhaw.hexboard.Label;
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) {
super(board);