public void paintBorders(Coordinate coord, Graphics g) {
Session session = quadMap.getSession();
MapData mapData = Game.getMapData();
FieldReader fieldReader = gameData.getFieldReader();
if (fieldReader.isFieldOwnerAvailable(position)) {
Long owner = fieldReader.getFieldOwner(position);
if (owner == null) {
return;
}
g.setColor(session.getNationColor(owner));
Coordinate[] neighborCoords = position.getDirectNeighborCoords();
for (Coordinate neighborPos : neighborCoords) {
Coordinate adjustedNeighborPos
= mapData.adjustToMapSize((Coordinate)neighborPos.clone());
if (adjustedNeighborPos == null) {
continue;
}
if (fieldReader.isFieldOwnerAvailable(adjustedNeighborPos)) {
Long neighborOwner = fieldReader.getFieldOwner(adjustedNeighborPos);
if (!(owner.equals(neighborOwner))) {
// if (neighborOwner != null && !(owner.equals(neighborOwner))) {
Coordinate offset = neighborPos.sub(position);
paintBorder(g, position, offset, coord);
}