public static IEnumerator RemoveAllUnwantedVehicles(ThreadBase t)
        {
            ushort num = 0;

            while ((uint)num < Singleton <VehicleManager> .instance.m_vehicles.m_size)
            {
                var vehicle     = Singleton <VehicleManager> .instance.m_vehicles.m_buffer[(int)num];
                var vehicleInfo = vehicle.Info;
                if (vehicleInfo != null && !SVMUtils.IsTrailer(vehicleInfo) && vehicle.m_transportLine == 0 && vehicle.m_sourceBuilding > 0)
                {
                    var buildingInfo = Singleton <BuildingManager> .instance.m_buildings.m_buffer[vehicle.m_sourceBuilding].Info;
                    var buildingSsd  = ServiceSystemDefinition.from(buildingInfo, vehicleInfo.m_vehicleType);
                    if (buildingSsd != null)
                    {
                        if (!buildingSsd.GetTransportExtension().IsModelCompatible(vehicle.m_sourceBuilding, vehicleInfo))
                        {
                            Singleton <VehicleManager> .instance.ReleaseVehicle(num);
                        }
                    }
                }
                if (num % 256 == 255)
                {
                    yield return(num);
                }
                num++;
            }
            yield break;
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj.GetType() != typeof(ServiceSystemDefinition))
            {
                return(false);
            }
            ServiceSystemDefinition other = (ServiceSystemDefinition)obj;

            return(level == other.level && service == other.service && subService == other.subService && vehicleType == other.vehicleType && outsideConnection == other.outsideConnection);
        }
 private static IEnumerable <IBasicBuildingAIOverrides> ListAiOverrides(BuildingInfo info, ServiceSystemDefinition instance)
 {
     if (SVMBuildingAIOverrideUtils.getBuildingOverrideExtension(info).Count == 0)
     {
         return(new List <IBasicBuildingAIOverrides>());
     }
     return(SVMBuildingAIOverrideUtils.getBuildingOverrideExtension(info).Where(aiOverride =>
                                                                                (info?.m_class?.m_service == instance?.service) &&
                                                                                instance?.subService == info?.m_class?.m_subService &&
                                                                                ((instance?.outsideConnection ?? false) || info?.m_class?.m_level == instance.level || (aiOverride?.ExtraAllowedLevels()?.Contains(instance.level) ?? false)) &&
                                                                                info?.GetAI() is OutsideConnectionAI == instance?.outsideConnection &&
                                                                                SVMUtils.logAndReturn(aiOverride?.AllowVehicleType(SVMUtils.logAndReturn(instance?.vehicleType ?? VehicleInfo.VehicleType.None, "EFF VEHICLE TYPE TESTED"), info?.GetAI()) ?? SVMUtils.logAndReturn(false, "AI OVERRIDE NULL!!!!!"), "AllowVehicleType")
                                                                                ));
 }