| 7 | if (airport1_tile != 0) {
| 7 | local tempList = AITileList();
|
|---|
| 8 | /* If we have the tile of the first airport, we don't want the second airport to be as close or as further */
| 8 | tempList.AddList(tileList);
|
|---|
| 9 | tileList.Valuate(AITile.GetDistanceSquareToTile, airport1_tile);
| 9 | for (local tile = tileList.Begin(); !tileList.IsEnd(); tile = tileList.Next()) {
|
|---|
| 10 | tileList.KeepBetweenValue(min_dist, max_dist);
| 10 | if (airport1_tile != 0) {
|
|---|
| 11 | tileList.Valuate(WrightAI.DistanceRealFake, airport1_tile);
| 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 | tileList.KeepBelowValue(fakedist);
| 12 | local distance_square = AITile.GetDistanceSquareToTile(tile, airport1_tile);
|
|---|
| 13 | if (tileList.Count() == 0) continue;
| 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 | }
|
|---|
| 16 | tileList.Valuate(AITile.IsBuildableRectangle, airport_x, airport_y);
| 49 | // if (airport1_tile != 0) {
|
|---|
| 17 | tileList.KeepValue(1)
| 50 | // /* If we have the tile of the first airport, we don't want the second airport to be as close or as further */
|
|---|
| 18 | if (tileList.Count() == 0) continue;
| 51 | // tileList.Valuate(AITile.GetDistanceSquareToTile, airport1_tile);
|
|---|
| 19 |
| 52 | // tileList.KeepBetweenValue(min_dist, max_dist);
|
|---|
| 20 | /* Sort on acceptance, remove places that don't have acceptance */
| 53 | // tileList.Valuate(WrightAI.DistanceRealFake, airport1_tile);
|
|---|
| 21 | tileList.Valuate(AITile.GetCargoAcceptance, this.cargoId, airport_x, airport_y, airport_rad);
| 54 | // tileList.KeepBelowValue(fakedist);
|
|---|
| 22 | tileList.RemoveBelowValue(10);
| 55 | // if (tileList.Count() == 0) continue;
|
|---|
| 23 | if (tileList.Count() == 0) continue;
| 56 | // }
|
|---|
| 24 |
| 57 | //
|
|---|
| 25 | tileList.Valuate(AITile.GetCargoProduction, this.cargoId, airport_x, airport_y, airport_rad);
| 58 | // tileList.Valuate(AITile.IsBuildableRectangle, airport_x, airport_y);
|
|---|
| 26 | tileList.RemoveBelowValue(18);
| 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);
|
|---|