Loading

Revision differences

Old revision #pjfxbqdcsNew revision #po9qykj5r
4    engine_list.KeepValue(1);  4    engine_list.KeepValue(1);  
5     5     
6    local small_aircraft = AIAirport.GetAirportType(tile_1) == AIAirport.AT_SMALL || AIAirport.GetAirportType(tile_2) == AIAirport.AT_SMALL ||  6    local small_aircraft = AIAirport.GetAirportType(tile_1) == AIAirport.AT_SMALL || AIAirport.GetAirportType(tile_2) == AIAirport.AT_SMALL ||  
7                           AIAirport.GetAirportType(tile_1) == AIAirport.AT_COMMUTER ||AIAirport.GetAirportType(tile_2) == AIAirport.AT_COMMUTER;  7                           AIAirport.GetAirportType(tile_1) == AIAirport.AT_COMMUTER || AIAirport.GetAirportType(tile_2) == AIAirport.AT_COMMUTER;
8    if (small_aircraft) {  8    if (small_aircraft) {  
9        engine_list.Valuate(AIEngine.GetPlaneType);  9        engine_list.Valuate(AIEngine.GetPlaneType);  
10        engine_list.RemoveValue(AIAirport.PT_BIG_PLANE);  10        engine_list.RemoveValue(AIAirport.PT_BIG_PLANE);  
  
20  20  
21    engine_list.Valuate(AIEngine.GetMaxSpeed);  21    engine_list.Valuate(AIEngine.GetMaxSpeed);  
22    engine_list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_DESCENDING);  22    engine_list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_DESCENDING);  
  23     
23    local dist = AIMap.DistanceSquare(tile_1, tile_2);  24    local dist = AIMap.DistanceSquare(tile_1, tile_2);  
24    engine_list.Valuate(AIEngine.GetMaximumOrderDistance);  24    engine_list.Valuate(WrightAI.GetMaximumOrderDistance);
25  25    engine_list.KeepAboveValue(dist - 1);
26    local temp_list = AIList();    
27    temp_list.AddList(engine_list);    
28    temp_list.KeepValue(0);    
29    for (local i = temp_list.Begin(); temp_list.HasNext(); i = temp_list.Next) {    
30        temp_list.SetValue(i, 0xFFFFFFFF);    
31    }    
32    engine_list.RemoveValue(0);    
33    engine_list.AddList(temp_list);    
34    engine_list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_DESCENDING);  27    engine_list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_DESCENDING);  
35    AILog.Warning(AIEngine.GetName(engine_list.Begin()) + " maximum distance is " + engine_list.GetValue(engine_list.Begin()));  28    AILog.Warning(AIEngine.GetName(engine_list.Begin()) + " maximum distance is " + engine_list.GetValue(engine_list.Begin()));  
36  29  
  
39    } else {  32    } else {  
40        return engine_list.Begin();  33        return engine_list.Begin();  
41    }  34    }  
  35}  
  36  
  37function::WrightAI::GetMaximumOrderDistance(engine) {  
  38    local dist = AIEngine.GetMaximumOrderDistance(engine);  
  39    return dist == 0 ? 0xFFFFFFFF : dist;  
42} 40}