// settlements
if ((yOnScreen + 12) % theme.Y_TILE_OFFSET <= 20) {// selects
// settlements on the right side
if ((((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) % 2 == 1) {// checks
// if row is up or down (this one is down)
coords[0] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
coords[1] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 2);
coords[2] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
} else { // this one is up
coords[0] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
coords[1] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
coords[2] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET);
}
}
if ((yOnScreen + 45) % 66 <= 20) {// selects settlements on the
// left side
if ((((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) % 2 == 1) {// checks
// if row is up or down (this one is down)
coords[0] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
coords[1] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2)
/ theme.X_TILE_OFFSET - 1),
(yOnScreen + 20) / theme.Y_TILE_OFFSET);
coords[2] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
} else {// this one is up
coords[0] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET) - 1,
(yOnScreen + 20) / theme.Y_TILE_OFFSET - 1);
coords[1] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2)
/ theme.X_TILE_OFFSET - 1),
(yOnScreen + 20) / theme.Y_TILE_OFFSET);
coords[2] = new MapCoord(
(((xOnScreen - 10) + theme.X_TILE_OFFSET / 2) / theme.X_TILE_OFFSET),
(yOnScreen + 20) / theme.Y_TILE_OFFSET);
}
}
// System.out.println(Arrays.toString(coords));
return coords;
}
}
xOnScreen = xStorage;
yOnScreen = yStorage;
if (SettlerMap.isPartofDownRow(isOriginDown, xOrd))
yOnScreen -= 33;
if ((xOnScreen) % theme.X_TILE_OFFSET > theme.TRIANGLE_AREA_WIDTH) {// horizontal
// pieces
if ((yOnScreen + 10) % theme.Y_TILE_OFFSET <= 22) {
coords = new MapCoord[2];
coords[0] = new MapCoord(xOrd, (yOnScreen + 46) / 66 - 1);
coords[1] = new MapCoord(xOrd, (yOnScreen + 46) / 66);
} else {
coords = new MapCoord[1];
coords[0] = new MapCoord(xOrd, yOrd);
}
} else {// is part of the central rectangle (diagonal pieces)
coords = new MapCoord[2];
coords[0] = new MapCoord();
coords[1] = new MapCoord();
coords[0].setX(xOrd - 1);
coords[1].setX(xOrd);
if (SettlerMap.isPartofDownRow(isOriginDown, xOrd)) {// part of down
// row
if ((yOnScreen + 66) % theme.Y_TILE_OFFSET <= theme.Y_TILE_OFFSET / 2) {
// Diagonal Left
coords[0] = new MapCoord(xOrd - 1, yOrd - 1);
coords[1] = new MapCoord(xOrd, yOrd - 1);
} else {
// Diagonal Right
coords[0] = new MapCoord(xOrd - 1, yOrd);
coords[1] = new MapCoord(xOrd, yOrd - 1);
}
} else {// part of up row
if (yOnScreen % theme.Y_TILE_OFFSET <= theme.Y_TILE_OFFSET / 2) {
// Diagonal Left
coords[0] = new MapCoord(xOrd - 1, yOrd - 1);
coords[1] = new MapCoord(xOrd, yOrd);
} else {
// Diagonal Right
coords[0] = new MapCoord(xOrd - 1, yOrd);
coords[1] = new MapCoord(xOrd, yOrd);
}
}
}
return coords;
}