From ef256e145310195076ef599ba31165a2f01522c1 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Fri, 27 Jan 2012 21:17:50 +0400 Subject: [PATCH] Detect incomplete thread and cloth items in workflow. --- library/modules/Materials.cpp | 4 ++-- plugins/workflow.cpp | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 7967fe386..48195aac2 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -769,10 +769,10 @@ bool Materials::ReadCreatureTypesEx (void) // body parts caste.bodypart.empty(); - uint32_t sizebp = ca->unknown1.body_parts.size(); + uint32_t sizebp = ca->body_info.body_parts.size(); for (uint32_t k = 0; k < sizebp; k++) { - df::body_part_raw *bp = ca->unknown1.body_parts[k]; + df::body_part_raw *bp = ca->body_info.body_parts[k]; t_bodypart part; part.id = bp->part_code; part.category = bp->part_name; diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 5a2073f1e..dffce5a4c 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -1086,9 +1086,25 @@ static void map_job_items(Core *c) int16_t imattype = item->getActualMaterial(); int32_t imatindex = item->getActualMaterialIndex(); + bool is_invalid = false; + // Special handling - if (dry_buckets && itype == item_type::BUCKET && !item->flags.bits.in_job) - dryBucket(item); + switch (itype) { + case item_type::BUCKET: + if (dry_buckets && !item->flags.bits.in_job) + dryBucket(item); + break; + + case item_type::THREAD: + if (item->getTotalDimension() < 15000) + is_invalid = true; + break; + + case item_type::CLOTH: + if (item->getTotalDimension() < 10000) + is_invalid = true; + break; + } if (item->flags.bits.melt && !item->flags.bits.owned && !itemBusy(item)) meltable_count++; @@ -1119,7 +1135,8 @@ static void map_job_items(Core *c) if (!ok) continue; - if (item->flags.bits.owned || + if (is_invalid || + item->flags.bits.owned || item->flags.bits.in_chest || item->isAssignedToStockpile() || itemInRealJob(item) ||