private void findPlanetOnStar(Star star) { int highestPopulationCongeniality = 0; for (BasePlanet planet : star.getPlanets()) { if (planet.getPopulationCongeniality() > highestPopulationCongeniality) { highestPopulationCongeniality = planet.getPopulationCongeniality(); mPlanetIndex = planet.getIndex(); } } }
private boolean findStarForNewEmpire(boolean allowEmptySectors) throws RequestException { ArrayList<Integer> sectorIds = findSectors(allowEmptySectors); for (int sectorId : sectorIds) { Sector sector = new SectorController().getSector(sectorId); Star star = findHighestScoreStar(sector); if (star == null) { continue; } // if we get here, then we've found the star. Also find which planet to // put the colony on. mStarID = star.getID(); findPlanetOnStar(star); return true; } return false; }