Пример #1
0
		IAssignment IJobSource.FindAssignment(ILivingObject _living)
		{
			var living = (LivingObject)_living;

			if (this.CurrentBuildOrder == null)
				return null;

			if (m_currentJob == null)
			{
				var job = CreateJob(this.CurrentBuildOrder);

				if (job == null)
				{
					trace.TraceWarning("XXX failed to create job, removing build order");
					RemoveBuildOrder(this.CurrentBuildOrder);
					return null;
				}

				m_currentJob = job;

				trace.TraceInformation("new build job created");
			}

			foreach (var a in m_currentJob.GetAssignments(living))
			{
				if (a.LaborID == LaborID.None || living.GetLaborEnabled(a.LaborID))
					return m_currentJob.FindAssignment(living);
			}

			return null;
		}