CSL_Traffic.PathManagerExtensions.CreatePath C# (CSharp) Méthode

CreatePath() public static méthode

public static CreatePath ( this pm, ExtendedVehicleType extendedVehicleType, uint &unit, Randomizer &randomizer, uint buildIndex, PathUnit startPosA, PathUnit startPosB, PathUnit endPosA, PathUnit endPosB, PathUnit vehiclePosition, NetInfo laneTypes, VehicleInfo vehicleTypes, float maxLength, bool isHeavyVehicle, bool ignoreBlocked, bool stablePath, bool skipQueue, bool randomParking ) : bool
pm this
extendedVehicleType ExtendedVehicleType
unit uint
randomizer Randomizer
buildIndex uint
startPosA PathUnit
startPosB PathUnit
endPosA PathUnit
endPosB PathUnit
vehiclePosition PathUnit
laneTypes NetInfo
vehicleTypes VehicleInfo
maxLength float
isHeavyVehicle bool
ignoreBlocked bool
stablePath bool
skipQueue bool
randomParking bool
Résultat bool
        public static bool CreatePath(this PathManager pm, ExtendedVehicleType extendedVehicleType, out uint unit, ref Randomizer randomizer, uint buildIndex, PathUnit.Position startPosA, PathUnit.Position startPosB, PathUnit.Position endPosA, PathUnit.Position endPosB, PathUnit.Position vehiclePosition, NetInfo.LaneType laneTypes, VehicleInfo.VehicleType vehicleTypes, float maxLength, bool isHeavyVehicle, bool ignoreBlocked, bool stablePath, bool skipQueue, bool randomParking)
        {
            if (ExtendedPathManager.PathFindFacades == null)
            {
                // Redirections are not installed correctly, fallbacking on the default code
                return pm.CreatePath(
                    out unit, 
                    ref randomizer, 
                    buildIndex, 
                    startPosA, 
                    startPosB, 
                    endPosA,  
                    endPosB, 
                    vehiclePosition, 
                    laneTypes, 
                    vehicleTypes, 
                    maxLength, 
                    isHeavyVehicle, 
                    ignoreBlocked, 
                    stablePath, 
                    skipQueue,
                    randomParking);
            }

            while (!Monitor.TryEnter(pm.m_bufferLock, SimulationManager.SYNCHRONIZE_TIMEOUT))
            {
            }
            uint num;
            try
            {
                if (!pm.m_pathUnits.CreateItem(out num, ref randomizer))
                {
                    unit = 0u;
                    bool result = false;
                    return result;
                }
                pm.m_pathUnitCount = (int)(pm.m_pathUnits.ItemCount() - 1u);
            }
            finally
            {
                Monitor.Exit(pm.m_bufferLock);
            }
            unit = num;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_simulationFlags = 1;
            if (isHeavyVehicle)
            {
                PathUnit[] expr_92_cp_0 = pm.m_pathUnits.m_buffer;
                UIntPtr expr_92_cp_1 = (UIntPtr)unit;
                expr_92_cp_0[(int)expr_92_cp_1].m_simulationFlags = (byte)(expr_92_cp_0[(int)expr_92_cp_1].m_simulationFlags | 16);
            }
            if (ignoreBlocked)
            {
                PathUnit[] expr_BB_cp_0 = pm.m_pathUnits.m_buffer;
                UIntPtr expr_BB_cp_1 = (UIntPtr)unit;
                expr_BB_cp_0[(int)expr_BB_cp_1].m_simulationFlags = (byte)(expr_BB_cp_0[(int)expr_BB_cp_1].m_simulationFlags | 32);
            }
            if (stablePath)
            {
                PathUnit[] expr_E4_cp_0 = pm.m_pathUnits.m_buffer;
                UIntPtr expr_E4_cp_1 = (UIntPtr)unit;
                expr_E4_cp_0[(int)expr_E4_cp_1].m_simulationFlags = (byte)(expr_E4_cp_0[(int)expr_E4_cp_1].m_simulationFlags | 64);
            }
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_pathFindFlags = 0;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_buildIndex = buildIndex;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position00 = startPosA;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position01 = endPosA;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position02 = startPosB;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position03 = endPosB;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_position11 = vehiclePosition;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_nextPathUnit = 0u;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_laneTypes = (byte)laneTypes;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_vehicleTypes = (byte)vehicleTypes;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_length = maxLength;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_positionCount = 20;
            pm.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_referenceCount = 1;
            int num2 = 10000000;
            ExtendedPathFindFacade pathFindFacade = null;
            for (int i = 0; i < ExtendedPathManager.PathFindFacades.Length; i++)
            {
                ExtendedPathFindFacade pathFind2 = ExtendedPathManager.PathFindFacades[i];
                if (pathFind2.IsAvailable && pathFind2.m_queuedPathFindCount < num2)
                {
                    num2 = pathFind2.m_queuedPathFindCount;
                    pathFindFacade = pathFind2;
                }
            }
            if (pathFindFacade != null && pathFindFacade.CalculatePath(unit, skipQueue, extendedVehicleType))
            {
                return true;
            }
            pm.ReleasePath(unit);
            return false;
        }
    }

Same methods

PathManagerExtensions::CreatePath ( this pm, ExtendedVehicleType extendedVehicleType, uint &unit, Randomizer &randomizer, uint buildIndex, PathUnit startPos, PathUnit endPos, NetInfo laneTypes, VehicleInfo vehicleTypes, float maxLength ) : bool
PathManagerExtensions::CreatePath ( this pm, ExtendedVehicleType extendedVehicleType, uint &unit, Randomizer &randomizer, uint buildIndex, PathUnit startPosA, PathUnit startPosB, PathUnit endPosA, PathUnit endPosB, NetInfo laneTypes, VehicleInfo vehicleTypes, float maxLength ) : bool
PathManagerExtensions::CreatePath ( this pm, ExtendedVehicleType extendedVehicleType, uint &unit, Randomizer &randomizer, uint buildIndex, PathUnit startPosA, PathUnit startPosB, PathUnit endPosA, PathUnit endPosB, NetInfo laneTypes, VehicleInfo vehicleTypes, float maxLength, bool isHeavyVehicle, bool ignoreBlocked, bool stablePath, bool skipQueue ) : bool
PathManagerExtensions