Move plant material detection to guess_job_material in workflow.

So that the data will be available to shortJobDescription.
develop
Alexander Gavrilov 2012-01-15 12:58:36 +04:00
parent 8135420d87
commit 54485d2551
1 changed files with 3 additions and 4 deletions

@ -829,7 +829,9 @@ static void guess_job_material(df::job *job, MaterialInfo &mat, df::dfhack_mater
}
// Material from the job reagent
if (!mat.isValid() && job->job_items.size() == 1)
if (!mat.isValid() && !job->job_items.empty() &&
(job->job_items.size() == 1 ||
job->job_items[0]->item_type == item_type::PLANT))
{
mat.decode(job->job_items[0]);
@ -899,9 +901,6 @@ static void compute_job_outputs(Core *c, ProtectedJob *pj)
break;
#define PLANT_PROCESS_MAT(flag, tag) \
if (!mat.isValid() && !job->job_items.empty()\
&& job->job_items[0]->item_type == item_type::PLANT) \
mat.decode(job->job_items[0]); \
if (mat.plant && mat.plant->flags.is_set(plant_raw_flags::flag)) \
mat.decode(mat.plant->material_defs.type_##tag, \
mat.plant->material_defs.idx_##tag); \