MCPcopy Create free account
hub / github.com/DFHack/dfhack / getMatchBits

Method getMatchBits

library/modules/Materials.cpp:472–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472void MaterialInfo::getMatchBits(df::job_item_flags1& ok, df::job_item_flags1& mask) const
473{
474 ok.whole = mask.whole = 0;
475 if (!isValid()) return;
476
477#define MAT_FLAG(name) material->flags.is_set(material_flags::name)
478#define FLAG(field, name) (field && field->flags.is_set(name))
479#define TEST(bit, check) \
480 mask.bits.bit = true; ok.bits.bit = !!(check);
481
482 bool structural = MAT_FLAG(STRUCTURAL_PLANT_MAT);
483
484 TEST(millable, structural && FLAG(plant, plant_raw_flags::MILL));
485 TEST(sharpenable, MAT_FLAG(IS_STONE));
486 TEST(processable, structural && FLAG(plant, plant_raw_flags::THREAD));
487 TEST(cookable, MAT_FLAG(EDIBLE_COOKED));
488 TEST(extract_bearing_plant, structural && FLAG(plant, plant_raw_flags::EXTRACT_STILL_VIAL));
489 TEST(extract_bearing_fish, false);
490 TEST(extract_bearing_vermin, false);
491 TEST(processable_to_vial, structural && FLAG(plant, plant_raw_flags::EXTRACT_VIAL));
492 TEST(processable_to_barrel, structural && FLAG(plant, plant_raw_flags::EXTRACT_BARREL));
493 TEST(solid, !(MAT_FLAG(ALCOHOL_PLANT) ||
494 MAT_FLAG(ALCOHOL_CREATURE) ||
495 MAT_FLAG(LIQUID_MISC_PLANT) ||
496 MAT_FLAG(LIQUID_MISC_CREATURE) ||
497 MAT_FLAG(LIQUID_MISC_OTHER)));
498 TEST(tameable_vermin, false);
499 TEST(sharpenable, MAT_FLAG(IS_STONE));
500 TEST(milk, linear_index(material->reaction_product.id, std::string("CHEESE_MAT")) >= 0);
501 TEST(undisturbed, MAT_FLAG(SILK));
502 //04000000 - "milkable" - vtable[107],1,1
503}
504
505void MaterialInfo::getMatchBits(df::job_item_flags2& ok, df::job_item_flags2& mask) const
506{

Callers 3

matchesMethod · 0.80
isUnusableBarFunction · 0.80
matchesHeatSafetyFunction · 0.80

Calls 4

vector_getFunction · 0.85
isValidFunction · 0.50
TESTFunction · 0.50
linear_indexFunction · 0.50

Tested by

no test coverage detected