public virtual bool CalculatePath(uint unit, bool skipQueue, ExtendedVehicleType vehicleType)
{
if (Singleton<PathManager>.instance.AddPathReference(unit))
{
while (!Monitor.TryEnter(this.m_queueLock, SimulationManager.SYNCHRONIZE_TIMEOUT))
{
}
try
{
if (skipQueue)
{
if (this.m_queueLast == 0u)
{
this.m_queueLast = unit;
}
else
{
this.m_pathUnits.m_buffer[(int)((UIntPtr)unit)].m_nextPathUnit = this.m_queueFirst;
}
this.m_queueFirst = unit;
}
else
{
if (this.m_queueLast == 0u)
{
this.m_queueFirst = unit;
}
else
{
this.m_pathUnits.m_buffer[(int)((UIntPtr)this.m_queueLast)].m_nextPathUnit = unit;
}
this.m_queueLast = unit;
}
PathUnit[] expr_BD_cp_0 = this.m_pathUnits.m_buffer;
UIntPtr expr_BD_cp_1 = (UIntPtr)unit;
expr_BD_cp_0[(int)expr_BD_cp_1].m_pathFindFlags = (byte)(expr_BD_cp_0[(int)expr_BD_cp_1].m_pathFindFlags | 1);
Facade.m_queuedPathFindCount++;
Monitor.Pulse(this.m_queueLock);
}
finally
{
Monitor.Exit(this.m_queueLock);
}
return true;
}
return false;
}