private static void insert(final int mapY, final int mustBePlain, final int... emptyOrPlain) { final short patchId = PartitionPatch.getPatchIdFromMapCoord(1, mapY); BorderHelper.BORDER_PATCHES.put(mustBePlain, patchId); for (final int optional : emptyOrPlain) { insert(mapY, mustBePlain | optional, new int[0]); insert(mapY, mustBePlain | optional, allExcept(emptyOrPlain, optional)); } }
private void setCellBlocked( final PartitionPatch patch, final int cellOffsetX, final int cellOffsetY) { final int dx = cellOffsetX + this.m_x; final int dy = cellOffsetY + this.m_y; for (int y = 0; y < 9; ++y) { for (int x = 0; x < 9; ++x) { if (patch == null || patch.isBlocked(x, y)) { this.setCellBlocked(x + dx, y + dy, true); } } } }
@Override public void fromPatch( final PartitionPatch patchTopLeft, final PartitionPatch patchTopRight, final PartitionPatch patchBottomLeft, final PartitionPatch patchBottomRight) { final int cellOffsetX = 9; final int cellOffsetY = 9; this.setCellBlocked(patchTopLeft, 0, 0); this.setCellBlocked(patchTopRight, 9, 0); this.setCellBlocked(patchBottomLeft, 0, 9); this.setCellBlocked(patchBottomRight, 9, 9); this.m_altitudes = PartitionPatch.getMergedAltitudes( patchTopLeft, patchTopRight, patchBottomLeft, patchBottomRight); this.m_murFinInfo = PartitionPatch.getMergedMurFinInfo( patchTopLeft, patchTopRight, patchBottomLeft, patchBottomRight); this.m_miscProperties = PartitionPatch.getMergedMiscProperties( patchTopLeft, patchTopRight, patchBottomLeft, patchBottomRight); }
private static boolean isEmptyPatchOrEntryBorder( final short[][] patches, final int x, final int y) { return isEmptyPatch(patches, x, y) || PartitionPatch.getMapCoordFromPatchId(patches[x][y]).getX() == 2; }
public static short getPatchIdForMask(final int mask) { if (!BorderHelper.BORDER_PATCHES.contains(mask)) { return PartitionPatch.getPatchIdFromMapCoord(1, 0); } return BorderHelper.BORDER_PATCHES.get(mask); }