Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void populateRandomly()
  2.         {
  3.                
  4.                 // No one expects the lolplanets inquisition
  5.                 for (int i = 0; i < 75; i++) {
  6.                         final PlanetData randomPlanet = aState.getPlanetData((String) MathUtils.getRandomElement(aState.getPlanetTypes()));
  7.                         addElem(new Planet(aState.getRandomPlayer(), getRandomLocation(randomPlanet.getDimension()),
  8.                                         randomPlanet.getType(), aState));
  9.                 }
  10.                
  11.                 // All your lolships are belong to us
  12.                 for (int i = 0; i < 1; i++) {
  13.                         final Player randomP = aState.getRandomPlayer();
  14.                         final Player randomP2 = aState.getRandomPlayer();
  15.                         final RaceData race = randomP.getRaceData();
  16.                         final String shipType = (String) MathUtils.getRandomElement(race.getShipTypes());
  17.                         Ship tempShip = new Ship(randomP, getRandomLocation(race.getShipData(shipType).getDimension()), shipType, aState);
  18.                         addElem(tempShip);
  19.                         PathfindingManager pfm = new PathfindingManager();
  20.                         ArrayList<GridLocation> path = pfm.findPath(this, tempShip, new Point(0,0));
  21.                        
  22.                         for (GridLocation c : path){
  23.                                 //tempShip = new Ship(randomP2, c, shipType, aState);
  24.                                 //addElem(tempShip);
  25.                                 if (c != null)
  26.                                         System.out.println(c.toString());
  27.                         }
  28.                 }
  29.         }