@@ -76,8 +76,7 @@ bool MaterialInfo::decode(df::item *item)
7676 return decode (-1 );
7777 else
7878 return decode (item->getActualMaterial (),
79- item->getActualMaterialIndex (),
80- item->getType ());
79+ item->getActualMaterialIndex ());
8180}
8281
8382bool MaterialInfo::decode (const df::material_vec_ref &vr, int idx)
@@ -88,11 +87,10 @@ bool MaterialInfo::decode(const df::material_vec_ref &vr, int idx)
8887 return decode (vr.mat_type [idx], vr.mat_index [idx]);
8988}
9089
91- bool MaterialInfo::decode (int16_t type, int32_t index, df::item_type itype )
90+ bool MaterialInfo::decode (int16_t type, int32_t index)
9291{
9392 this ->type = type;
9493 this ->index = index;
95- this ->itype = itype;
9694
9795 material = NULL ;
9896 mode = Builtin; subtype = 0 ;
@@ -447,19 +445,22 @@ bool MaterialInfo::matches(const df::dfhack_material_category &cat)
447445
448446#undef TEST
449447
450- bool MaterialInfo::matches (const df::job_item &item)
448+ bool MaterialInfo::matches (const df::job_item &item, df::item_type itype )
451449{
452450 if (!isValid ()) return false ;
453451
454452 df::job_item_flags1 ok1, mask1;
455453 getMatchBits (ok1, mask1);
456454
457- df::job_item_flags2 ok2, mask2;
455+ df::job_item_flags2 ok2, mask2, xmask2 ;
458456 getMatchBits (ok2, mask2);
459457
460458 df::job_item_flags3 ok3, mask3;
461459 getMatchBits (ok3, mask3);
462460
461+ xmask2.bits .non_economic = itype != df::item_type::BOULDER ;
462+ mask2.whole &= ~xmask2.whole ;
463+
463464 return bits_match (item.flags1 .whole , ok1.whole , mask1.whole ) &&
464465 bits_match (item.flags2 .whole , ok2.whole , mask2.whole ) &&
465466 bits_match (item.flags3 .whole , ok3.whole , mask3.whole );
@@ -516,8 +517,7 @@ void MaterialInfo::getMatchBits(df::job_item_flags2 &ok, df::job_item_flags2 &ma
516517 TEST (fire_safe, material->heat .melting_point > 11000 );
517518 TEST (magma_safe, material->heat .melting_point > 12000 );
518519 TEST (deep_material, FLAG (inorganic, inorganic_flags::SPECIAL ));
519- TEST (non_economic, !inorganic || !(ui && vector_get (ui->economic_stone , index)) || itype == df::item_type::BAR );
520-
520+ TEST (non_economic, !inorganic || !(ui && vector_get (ui->economic_stone , index)));
521521 TEST (plant, plant);
522522 TEST (silk, MAT_FLAG (SILK ));
523523 TEST (leather, MAT_FLAG (LEATHER ));
0 commit comments