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

Function write_cat

plugins/stockpiles/StockpileSerializer.cpp:713–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711
712template<typename T_cat_set>
713static void write_cat(color_ostream& out, const char* name, bool include_types, uint32_t cat_flags,
714 enum df::stockpile_group_set::Mask cat_mask,
715 std::function<T_cat_set* ()> mutable_cat_fn,
716 std::function<bool(color_ostream&, T_cat_set*)> write_cat_fn) {
717
718 if (!(cat_flags & cat_mask))
719 return;
720
721 T_cat_set* cat_set = mutable_cat_fn();
722
723 if (!include_types) {
724 DEBUG(log, out).print("including all for {} since only category is being recorded\n", name);
725 cat_set->set_all(true);
726 return;
727 }
728
729 if (write_cat_fn(out, cat_set)) {
730 // all fields were set. clear them and use the "all" flag instead so "all" can be applied
731 // to other worlds with other generated types
732 DEBUG(log, out).print("including all for {} since all fields were enabled\n", name);
733 cat_set->Clear();
734 cat_set->set_all(true);
735 }
736}
737
738void StockpileSettingsSerializer::write(color_ostream& out, uint32_t includedElements) {
739 if (includedElements & INCLUDED_ELEMENTS_GENERAL)

Callers

nothing calls this directly

Calls 2

printMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected