summaryrefslogtreecommitdiff
path: root/plugins/workflow.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-01-15 12:58:36 +0400
committerAlexander Gavrilov2012-01-15 12:58:36 +0400
commit54485d25510c824809982d58dfb9045088f4572a (patch)
tree64914c804f08851c4739ff3d9ce2774f0e1ec158 /plugins/workflow.cpp
parent8135420d87b88917b734ec448cfd4677279fead2 (diff)
downloaddfhack-54485d25510c824809982d58dfb9045088f4572a.tar.gz
dfhack-54485d25510c824809982d58dfb9045088f4572a.tar.bz2
dfhack-54485d25510c824809982d58dfb9045088f4572a.tar.xz
Move plant material detection to guess_job_material in workflow.
So that the data will be available to shortJobDescription.
Diffstat (limited to 'plugins/workflow.cpp')
-rw-r--r--plugins/workflow.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp
index e8ac9a4c..4306c343 100644
--- a/plugins/workflow.cpp
+++ b/plugins/workflow.cpp
@@ -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); \