Loading

Paste #p9xonsoqa

  1.             AILog.Info("Checking " + AITown.GetName(town) + " for an airport of type " + WrightAI.GetAirportTypeName(a));
  2.  
  3.             local rectangleCoordinates = this.TownAirportRadRect(a, town);
  4.             local tileList = AITileList();
  5.             tileList.AddRectangle(rectangleCoordinates[0], rectangleCoordinates[1]);
  6.  
  7.             if (airport1_tile != 0) {
  8.                 /* If we have the tile of the first airport, we don't want the second airport to be as close or as further */
  9.                 tileList.Valuate(AITile.GetDistanceSquareToTile, airport1_tile);
  10.                 tileList.KeepBetweenValue(min_dist, max_dist);
  11.                 tileList.Valuate(WrightAI.DistanceRealFake, airport1_tile);
  12.                 tileList.KeepBelowValue(fakedist);
  13.                 if (tileList.Count() == 0) continue;
  14.             }
  15.  
  16.             tileList.Valuate(AITile.IsBuildableRectangle, airport_x, airport_y);
  17.             tileList.KeepValue(1)
  18.             if (tileList.Count() == 0) continue;
  19.  
  20.             /* Sort on acceptance, remove places that don't have acceptance */
  21.             tileList.Valuate(AITile.GetCargoAcceptance, this.cargoId, airport_x, airport_y, airport_rad);
  22.             tileList.RemoveBelowValue(10);
  23.             if (tileList.Count() == 0) continue;
  24.  
  25.             tileList.Valuate(AITile.GetCargoProduction, this.cargoId, airport_x, airport_y, airport_rad);
  26.             tileList.RemoveBelowValue(18);
  27.             /* Couldn't find a suitable place for this town, skip to the next */
  28.             if (tileList.Count() == 0) continue;
  29.             tileList.Sort(AIList.SORT_BY_VALUE, false);

Comments