diff --git a/plugins/buildingplan-lib.h b/plugins/buildingplan-lib.h index 7ec0c41d4..6975960d2 100644 --- a/plugins/buildingplan-lib.h +++ b/plugins/buildingplan-lib.h @@ -114,7 +114,9 @@ struct ItemFilter bool decorated_only; ItemFilter() : min_quality(df::item_quality::Ordinary), decorated_only(false), valid(true) - { } + { + clear(); // mat_mask is not cleared by default (see issue #1047) + } bool matchesMask(DFHack::MaterialInfo &mat); diff --git a/plugins/lua/stockflow.lua b/plugins/lua/stockflow.lua index 6027bb455..dd83e65d9 100644 --- a/plugins/lua/stockflow.lua +++ b/plugins/lua/stockflow.lua @@ -1135,8 +1135,7 @@ function check_stockpiles(verbose) if trigger and trigger.divisor then local reaction = spec.entry.ints[entry_ints.order_number] local filled, empty = check_pile(spec.stockpile, verbose) - local amount = trigger.filled and filled or empty - amount = (amount - (amount % trigger.divisor)) / trigger.divisor + local amount = math.floor((trigger.filled and filled or empty) / trigger.divisor) result[reaction] = (result[reaction] or 0) + amount end end diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 55f1dc504..f8f9e8231 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -357,7 +357,9 @@ public: : is_craft(false), min_quality(item_quality::Ordinary), is_local(false), weight(0), item_amount(0), item_count(0), item_inuse_amount(0), item_inuse_count(0), is_active(false), cant_resume_reported(false), low_stock_reported(-1) - {} + { + mat_mask.whole = 0; // see https://github.com/DFHack/dfhack/issues/1047 + } int goalCount() { return config.ival(0); } void setGoalCount(int v) { config.ival(0) = v; }