Example #1
0
  private static final void connectBorders(Tile t1, int b1, Tile t2, int b2) {
    t1.getBorder()[b1].setZone(
        t1.getBorder()[b1].getZone().mergeInto(t2.getBorder()[b2].getZone()));

    t1.getBorderConnections()[b1] = t2.getBorder()[b2];
    t2.getBorderConnections()[b2] = t1.getBorder()[b1];
  }
Example #2
0
 public static final void matchTiles(Tile tile, Tile top, Tile bottom, Tile left, Tile right)
     throws InvalidTileException {
   if (tile == null) throw new InvalidTileException("Tile can not be null");
   if (top != null) {
     match(tile.getBorder()[0], top.getBorder()[8]);
     match(tile.getBorder()[1], top.getBorder()[7]);
     match(tile.getBorder()[2], top.getBorder()[6]);
   }
   if (right != null) {
     match(tile.getBorder()[3], right.getBorder()[11]);
     match(tile.getBorder()[4], right.getBorder()[10]);
     match(tile.getBorder()[5], right.getBorder()[9]);
   }
   if (bottom != null) {
     match(tile.getBorder()[6], bottom.getBorder()[2]);
     match(tile.getBorder()[7], bottom.getBorder()[1]);
     match(tile.getBorder()[8], bottom.getBorder()[0]);
   }
   if (left != null) {
     match(tile.getBorder()[9], left.getBorder()[5]);
     match(tile.getBorder()[10], left.getBorder()[4]);
     match(tile.getBorder()[11], left.getBorder()[3]);
   }
 }