// used only once: to find a Nuke Silo for nuke launch
// should find a building that's #idx in the [BuildingTypes], owned by this house, within withinDistance of house base

BuildingClass * HouseClass::FindOwnedBuildingType(int idx, signed int withinDistance) {
  if(this->OwnedBuildingTypes0->GetItemCount(idx) <= 0 || this->OwnedBuildings.Length <= 0) {
    return NULL;
  }

  int curIdx = 0;
  for(int i = 0; i < this->OwnedBuildings.Length; ++i) {
    BuildingClass *curBld = this->OwnedBuildings[i];
    if(!curBld || curBld->NotOnMap) {
      continue;
    }
    int testIdx = -1;
    for(int j = 0; j < vec_BuildingTypes.Length; ++j) {
      ++testIdx;
      if(curBld->BuildingType == vec_BuildingTypes[j]) {
        break;
      }
    }
    if(testIdx != idx) {
      continue;
    }
    if(withinDistance == -1) {
      return curBld;
    }
    if(this->Base->CalculateDistanceTo(curBld->GetCoords()) == withinDistance) {
      return curBld;
    }
  }
  return 0;
}