public QueuedCaravanJob Dequeue() { if (this.jobs.NullOrEmpty <QueuedCaravanJob>()) { return(null); } QueuedCaravanJob result = this.jobs[0]; this.jobs.RemoveAt(0); return(result); }
private CaravanJob DetermineNextJob() { if (this.jobQueue != null) { while (this.jobQueue.Count > 0 && !this.jobQueue.Peek().job.CanBeginNow(this.caravan)) { QueuedCaravanJob queuedJob = this.jobQueue.Dequeue(); if (this.debugLog) { this.DebugLogEvent(" Throwing away queued job that I cannot begin now: " + queuedJob.job); } } if (this.jobQueue.Count > 0) { QueuedCaravanJob queuedJob2 = this.jobQueue.Dequeue(); if (this.debugLog) { this.DebugLogEvent(" Returning queued job: " + queuedJob2.job); } return(queuedJob2.job); } } return(null); }