Loading

Paste #pg2rkpgsq

  1.         /* Aircraft too old? Sell it. */
  2.         if (AIVehicle.GetAgeLeft(i) < 365) {
  3.             /* Send the vehicle to depot if we didn't do so yet */
  4.             if (!vehicle_to_depot.rawin(i) || vehicle_to_depot.rawget(i) != true) {
  5.                 AILog.Info("Sending " + AIVehicle.GetName(i) + " to hangar to be sold, due to its old age.");
  6.                 AIVehicle.SendVehicleToDepot(i);
  7.                 vehicle_to_depot.rawset(i, true);
  8.             }
  9.         }
  10.  
  11.         /* Sell it once it really is in the depot */
  12.         if (vehicle_to_depot.rawin(i) && vehicle_to_depot.rawget(i) == true && AIVehicle.IsStoppedInDepot(i)) {
  13.             AILog.Info("Selling " + AIVehicle.GetName(i) + " as it finally is in a hangar. (From " + AIStation.GetName(AIStation.GetStationID(AIOrder.GetOrderDestination(i, 0))) + " to " + AIStation.GetName(AIStation.GetStationID(AIOrder.GetOrderDestination(i, 1))) + ")");
  14.             local list2 = AIVehicleList_Station(AIStation.GetStationID(AIOrder.GetOrderDestination(i, 0)));
  15.             list2.Valuate(AIVehicle.GetVehicleType);
  16.             list2.KeepValue(AIVehicle.VT_AIR);
  17.             /* Last vehicle on this route? Consider increasing the minimum distance for the next routes. */
  18.             if (list2.Count() == 1) {
  19.                 if (AIVehicle.GetProfitLastYear(i) < 10000 && AIVehicle.GetProfitThisYear(i) < 10000) {
  20.                     AILog.Warning("Last vehicle on this route!");
  21.                     local dist = this.distance_of_route.rawget(i);
  22.                     if (min_air_distance < max_air_distance - dist) {
  23.                         min_air_distance = dist;
  24.                     }
  25.                 }
  26.             }
  27.             if (AIVehicle.SellVehicle(i)) {
  28.                 vehicle_to_depot.rawdelete(i);
  29.             }
  30.         }
  31.     }

Comments