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

Method DefaultItemFilters

plugins/buildingplan/defaultitemfilters.cpp:41–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41DefaultItemFilters::DefaultItemFilters(color_ostream &out, BuildingTypeKey key, const std::vector<const df::job_item *> &jitems)
42 : key(key), choose_items(ItemSelectionChoice::ITEM_SELECTION_CHOICE_FILTER) {
43 DEBUG(control,out).print("creating persistent data for filter key {},{},{}\n",
44 ENUM_AS_STR(std::get<0>(key)), std::get<1>(key), std::get<2>(key));
45 filter_config = World::AddPersistentSiteData(FILTER_CONFIG_KEY);
46 filter_config.set_int(FILTER_CONFIG_TYPE, std::get<0>(key));
47 filter_config.set_int(FILTER_CONFIG_SUBTYPE, std::get<1>(key));
48 filter_config.set_int(FILTER_CONFIG_CUSTOM, std::get<2>(key));
49 filter_config.set_int(FILTER_CONFIG_CHOOSE_ITEMS, choose_items);
50 item_filters.resize(jitems.size());
51 for (size_t idx = 0; idx < jitems.size(); ++idx) {
52 item_filters[idx].setMaxQuality(get_max_quality(jitems[idx]), true);
53 }
54 filter_config.set_str(serialize(item_filters, specials));
55}
56
57DefaultItemFilters::DefaultItemFilters(color_ostream &out, PersistentDataItem &filter_config, const std::vector<const df::job_item *> &jitems)
58 : key(getKey(filter_config)), filter_config(filter_config) {

Callers

nothing calls this directly

Calls 8

get_max_qualityFunction · 0.85
split_stringFunction · 0.85
deserialize_item_filtersFunction · 0.85
setMaxQualityMethod · 0.80
serializeFunction · 0.70
printMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected