Loading

Revision differences

Old revision #p2gbtm0utNew revision #petu1y4ig
  1/* method 1 */         
  2        for (local tile = 0; tile <= AIMap.GetMapSize(); tile++) {  
  3            if (!AIMap.IsValidTile(tile)) continue;  
  4            local dist = AITile.GetDistanceSquareToTile(tile, airport1_tile);  
  5            local fake = WrightAI.DistanceRealFake(tile, airport1_tile);  
  6            if (dist <= max_dist && dist >= min_dist && fake <= fakedist * 11 / 10) {  
  7                tileList.AddItem(tile, dist);  
  8                AISign.BuildSign(tile, ("" + dist + ""));  
  9            }  
  10        }  
  11        if (tileList.Count() == 0) {  
  12            //continue;  
  13            AILog.Info("tileList.Count() is 0");  
  14        }  
1        local closestTownscopy = AIList();  15        local closestTownscopy = AIList();  
2        for (local town = closestTowns.Begin(); closestTowns.HasNext(); town = closestTowns.Next()) {  2        for (local tile = tileList.Begin(); tileList.HasNext(); tile = tileList.Next()) {
3            local closest_town = AITile.GetClosestTown(tile);  17            local closest_town = AITile.GetClosestTown(tile);  
4            if (closestTowns.HasItem(closest_town) {  4            if (closestTowns.HasItem(closest_town)) {
5                closestTownscopy.AddItem(town);  19                closestTownscopy.AddItem(town);  
6            }  20            }  
7        }  21        }  
8        closestTowns.Clear();  22        closestTowns.Clear();  
9        closestTowns.AddList(closestTownscopy); 23        closestTowns.AddList(closestTownscopy);
   24
   25/* method 2 */
   26//      local closestTownscopy = AIList();
   27//        closestTownscopy.AddList(closestTowns);
   28//        for (local town = closestTownscopy.Begin(); closestTownscopy.HasNext(); town = closestTownscopy.Next()) {
   29//            local dist = AITile.GetDistanceSquareToTile(AITown.GetLocation(town), airport1_tile);
   30//            local fake = WrightAI.DistanceRealFake(AITown.GetLocation(town), airport1_tile);
   31//            if (!(dist <= max_dist && dist >= min_dist && fake <= fakedist * 11 / 10)) {
   32//                closestTowns.RemoveItem(town);
   33//            }
   34//        }