local vehicleList = this.vehicleList();
local unitnumberList = AIList();
for (local vehicle = vehicleList.Begin(); !vehicleList.IsEnd(); vehicle = vehicleList.Next()) {
if (AIVehicle.IsValidVehicle(vehicle) && AIVehicle.GetVehicleType(vehicle) == AIVehicle.VT_ROAD) {
local unitnumber = AIVehicle.GetUnitNumber(vehicle);
if (!unitnumberList.HasItem(unitnumber)) {
unitnumberList.AddItem(unitnumber, vehicle);
} else {
local value = unitnumberList.GetValue(unitnumber);
if (value != vehicle) {
unitnumberList.SetValue(unitnumber, vehicle);
}
}
}
}
for (local unit = unitnumberList.Begin(); !unitnumberList.IsEnd(); unit = unitnumberList.Next()) {
if (AIVehicle.IsValidVehicle(AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD))) {
if (AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) == unitnumberList.GetValue(unit)) {
AILog.Info("unit_number " + unit + " is vehicle_id " + AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) + " == " + unitnumberList.GetValue(unit));
} else {
AILog.Error("unit_number " + unit + " is vehicle_id " + AIVehicle.GetVehicleID(unit, AIVehicle.VT_ROAD) + " != " + unitnumberList.GetValue(unit));
AIController.Break(" ");
}
} else {
AILog.Error("unit_number " + unit + " is vehicle_id " + INVALID_VEHICLE + " <> " + unitnumberList.GetValue(unit) + " INVALID_VEHICLE");
AIController.Break(" ");
}
}