Loading

Paste #psjlkah9v

  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.             local tempList = AITileList();
  8.             tempList.AddList(tileList);
  9.             for (local tile = tileList.Begin(); !tileList.IsEnd(); tile = tileList.Next()) {
  10.                 if (airport1_tile != 0) {
  11.                     /* If we have the tile of the first airport, we don't want the second airport to be as close or as further */
  12.                     local distance_square = AITile.GetDistanceSquareToTile(tile, airport1_tile);
  13.                     if (!(distance_square > min_dist)) {
  14.                         tempList.RemoveItem(tile);
  15.                         continue;
  16.                     }
  17.                     if (!(distance_square < max_dist)) {
  18.                         tempList.RemoveItem(tile);
  19.                         continue;
  20.                     }
  21.                     if (!(WrightAI.DistanceRealFake(tile, airport1_tile) < fakedist)) {
  22.                         tempList.RemoveItem(tile);
  23.                         continue;
  24.                     }
  25.                 }
  26.  
  27.                 if (!(AITile.IsBuildableRectangle(tile, airport_x, airport_y))) {
  28.                     tempList.RemoveItem(tile);
  29.                     continue;
  30.                 }
  31.  
  32.                 /* Sort on acceptance, remove places that don't have acceptance */
  33.                 if (AITile.GetCargoAcceptance(tile, this.cargoId, airport_x, airport_y, airport_rad) < 10) {
  34.                     tempList.RemoveItem(tile);
  35.                     continue;
  36.                 }
  37.                
  38.                 local cargo_production = AITile.GetCargoProduction(tile, this.cargoId, airport_x, airport_y, airport_rad);
  39.                 if (cargo_production < 18) {
  40.                     tempList.RemoveItem(tile);
  41.                     continue;
  42.                 } else {
  43.                     tempList.SetValue(tile, cargo_production);
  44.                 }
  45.             }
  46.             tileList.Clear();
  47.             tileList.AddList(tempList);
  48.  
  49. //          if (airport1_tile != 0) {
  50. //              /* If we have the tile of the first airport, we don't want the second airport to be as close or as further */
  51. //              tileList.Valuate(AITile.GetDistanceSquareToTile, airport1_tile);
  52. //              tileList.KeepBetweenValue(min_dist, max_dist);
  53. //              tileList.Valuate(WrightAI.DistanceRealFake, airport1_tile);
  54. //              tileList.KeepBelowValue(fakedist);
  55. //              if (tileList.Count() == 0) continue;
  56. //          }
  57. //
  58. //          tileList.Valuate(AITile.IsBuildableRectangle, airport_x, airport_y);
  59. //          tileList.KeepValue(1)
  60. //          if (tileList.Count() == 0) continue;
  61. //
  62. //          /* Sort on acceptance, remove places that don't have acceptance */
  63. //          tileList.Valuate(AITile.GetCargoAcceptance, this.cargoId, airport_x, airport_y, airport_rad);
  64. //          tileList.RemoveBelowValue(10);
  65. //          if (tileList.Count() == 0) continue;
  66. //
  67. //          tileList.Valuate(AITile.GetCargoProduction, this.cargoId, airport_x, airport_y, airport_rad);
  68. //          tileList.RemoveBelowValue(18);
  69.             /* Couldn't find a suitable place for this town, skip to the next */
  70.             if (tileList.Count() == 0) continue;
  71.             tileList.Sort(AIList.SORT_BY_VALUE, false);

Version history

Revision # Author Created at
p9xonsoqa Anonymous 26 Mar 2019, 18:35:22 UTC Diff

Comments