/** Refreshes the local systems depending on player X and Y location. */ public static void setNewLocals() { /* * Take max fuel cap Take current location Calculate max distance player * can travel */ LocalPlanetView.list_2.removeAll(); Ship currentShip = Driver.Player.getShip(); int fuelCap = currentShip.getFuelCapacity(); int maxDistance = fuelCap * DISTANCEPERFUELUNIT; int playerX = Driver.Player.getPlayerX(); int playerY = Driver.Player.getPlayerY(); for (int i = 0; i < Driver.ListOfSystems.size(); i++) { SolarSystem sys = Driver.ListOfSystems.get(i); int sysX = sys.getxLocation(); int sysY = sys.getyLocation(); int distance = (int) ((Math.pow(playerX - sysX, 2)) + (Math.pow(playerY - sysY, 2))); distance = (int) (Math.sqrt(distance)); if (distance < maxDistance) { LocalPlanetView.list_2.add(sys.getSystemName()); } } }