checkMapOptimized method

bool checkMapOptimized(
  1. int x,
  2. int y,
  3. double w,
  4. double h,
)

Implementation

bool checkMapOptimized(int x, int y, double w, double h) {
  if (mapX - x < w) {
    return false;
  }
  if (mapY - y < h) {
    return false;
  }
  for (int i = x.toInt(); i < x.toInt() + w; i++) {
    if (map[i][(y + h.toInt() - 1).toInt()] == 1) {
      return false;
    }
    if (map[i][y + 1] == 1) {
      return false;
    }
  }
  return true;
}