Пример #1
0
  private boolean checkBlocked(final OffsetPoint n, final OffsetPoint b) {
    final int x = n.getX();
    final int y = n.getY();
    final int dx = n.getX() - b.getX();
    final int dy = n.getY() - b.getY();

    int flag = map.get(toTile(n));

    if (dx == 0) {
      if (dy == 0) {
        return false;
      }
      int f = Y_WALL[(dy + 1) / 2];
      return (flag & f) != f;
    } else if (dy == 0) {
      int f = X_WALL[(dx + 1) / 2];
      return (flag & f) != f;
    } else {
      // Both directions
      final int diagNum = (dy + 1) | ((dx + 1) / 2);
      if ((flag & DIAG_WALL[diagNum]) == 0) {
        return true;
      }
      if ((!walkable(n.derive(-dx, 0)) || (map.get(toTile(x - dx, y)) & DIAG_X[diagNum]) == 0)
          && (!walkable(n.derive(0, -dy)) || (map.get(toTile(x, y - dy)) & DIAG_Y[diagNum]) == 0)) {
        return true;
      }
    }
    return false;
  }
Пример #2
0
 public Node(final Node prev, final OffsetPoint loc) {
   this(prev, loc.getX(), loc.getY());
 }
Пример #3
0
 private Tile toTile(OffsetPoint p) {
   return toTile(p.getX(), p.getY());
 }