Count hospital supplies as busy, and detect soap-producing reactions.

develop
Alexander Gavrilov 2012-01-16 19:45:38 +04:00
parent d972b07d57
commit 4811d2945e
1 changed files with 16 additions and 8 deletions

@ -777,6 +777,7 @@ static void compute_custom_job(ProtectedJob *pj, df::job *job)
continue; continue;
MaterialInfo mat(prod); MaterialInfo mat(prod);
df::dfhack_material_category mat_mask(0);
bool get_mat_prod = prod->flags.is_set(GET_MATERIAL_PRODUCT); bool get_mat_prod = prod->flags.is_set(GET_MATERIAL_PRODUCT);
if (get_mat_prod || prod->flags.is_set(GET_MATERIAL_SAME)) if (get_mat_prod || prod->flags.is_set(GET_MATERIAL_SAME))
@ -799,20 +800,26 @@ static void compute_custom_job(ProtectedJob *pj, df::job *job)
if (get_mat_prod) if (get_mat_prod)
{ {
if (!mat.isValid()) std::string code = prod->get_material.product_code;
continue;
int idx = linear_index(mat.material->reaction_product.id, if (mat.isValid())
prod->get_material.product_code); {
int idx = linear_index(mat.material->reaction_product.id, code);
if (idx < 0) if (idx < 0)
continue; continue;
mat.decode(mat.material->reaction_product.material, idx); mat.decode(mat.material->reaction_product.material, idx);
} }
else
{
if (code == "SOAP_MAT")
mat_mask.bits.soap = true;
}
}
} }
link_job_constraint(pj, prod->item_type, prod->item_subtype, link_job_constraint(pj, prod->item_type, prod->item_subtype,
0, mat.type, mat.index); mat_mask, mat.type, mat.index);
} }
} }
@ -1113,6 +1120,7 @@ static void map_job_items(Core *c)
continue; continue;
if (item->flags.bits.owned || if (item->flags.bits.owned ||
item->flags.bits.in_chest ||
item->isAssignedToStockpile() || item->isAssignedToStockpile() ||
itemInRealJob(item) || itemInRealJob(item) ||
itemBusy(item)) itemBusy(item))