Loading

Paste #pg5gscoqu

  1.         local vehicleList = this.vehicleList();
  2.         local unitnumberList = AIList();
  3.         for (local vehicle = vehicleList.Begin(); !vehicleList.IsEnd(); vehicle = vehicleList.Next()) {
  4.             if (AIVehicle.IsValidVehicle(vehicle) && AIVehicle.GetVehicleType(vehicle) == AIVehicle.VT_ROAD) {
  5.                 local unitnumber = AIVehicle.GetUnitNumber(vehicle);
  6.                 if (!unitnumberList.HasItem(unitnumber)) {
  7.                     unitnumberList.AddItem(unitnumber, vehicle);
  8.                 } else {
  9.                     local value = unitnumberList.GetValue(unitnumber);
  10.                     if (value != vehicle) {
  11.                         unitnumberList.SetValue(unitnumber, vehicle);
  12.                     }
  13.                 }
  14.             }
  15.         }
  16.        
  17.         for (local unit = unitnumberList.Begin(); !unitnumberList.IsEnd(); unit = unitnumberList.Next()) {
  18.             if (AIVehicle.IsValidVehicle(AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD))) {
  19.                 if (AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) == unitnumberList.GetValue(unit)) {
  20.                     AILog.Info("unit_number " + unit + " is vehicle_id " + AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) + " == " + unitnumberList.GetValue(unit));
  21.                 } else {
  22.                     AILog.Error("unit_number " + unit + " is vehicle_id " + AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) + " != " + unitnumberList.GetValue(unit));
  23.                     AIController.Break(" ");
  24.                 }
  25.             } else {
  26.                 AILog.Error("unit_number " + unit + " is vehicle_id " + INVALID_VEHICLE + " <> " + unitnumberList.GetValue(unit) + " INVALID_VEHICLE");
  27.                 AIController.Break(" ");
  28.             }
  29.         }

Comments