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

Method write

plugins/stockpiles/StockpileSerializer.cpp:738–835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738void StockpileSettingsSerializer::write(color_ostream& out, uint32_t includedElements) {
739 if (includedElements & INCLUDED_ELEMENTS_GENERAL)
740 write_general(out);
741
742 if (!(includedElements & INCLUDED_ELEMENTS_CATEGORIES))
743 return;
744
745 DEBUG(log, out).print("GROUP SET {}\n",
746 bitfield_to_string(mSettings->flags).c_str());
747
748 bool include_types = 0 != (includedElements & INCLUDED_ELEMENTS_TYPES);
749
750 write_cat<StockpileSettings_AmmoSet>(out, "ammo", include_types,
751 mSettings->flags.whole,
752 mSettings->flags.mask_ammo,
753 std::bind(&StockpileSettings::mutable_ammo, &mBuffer),
754 std::bind(&StockpileSettingsSerializer::write_ammo, this, _1, _2));
755 write_cat<StockpileSettings_AnimalsSet>(out, "animals", include_types,
756 mSettings->flags.whole,
757 mSettings->flags.mask_animals,
758 std::bind(&StockpileSettings::mutable_animals, &mBuffer),
759 std::bind(&StockpileSettingsSerializer::write_animals, this, _1, _2));
760 write_cat<StockpileSettings_ArmorSet>(out, "armor", include_types,
761 mSettings->flags.whole,
762 mSettings->flags.mask_armor,
763 std::bind(&StockpileSettings::mutable_armor, &mBuffer),
764 std::bind(&StockpileSettingsSerializer::write_armor, this, _1, _2));
765 write_cat<StockpileSettings_BarsBlocksSet>(out, "bars_blocks", include_types,
766 mSettings->flags.whole,
767 mSettings->flags.mask_bars_blocks,
768 std::bind(&StockpileSettings::mutable_barsblocks, &mBuffer),
769 std::bind(&StockpileSettingsSerializer::write_bars_blocks, this, _1, _2));
770 write_cat<StockpileSettings_ClothSet>(out, "cloth", include_types,
771 mSettings->flags.whole,
772 mSettings->flags.mask_cloth,
773 std::bind(&StockpileSettings::mutable_cloth, &mBuffer),
774 std::bind(&StockpileSettingsSerializer::write_cloth, this, _1, _2));
775 write_cat<StockpileSettings_CoinSet>(out, "coin", include_types,
776 mSettings->flags.whole,
777 mSettings->flags.mask_coins,
778 std::bind(&StockpileSettings::mutable_coin, &mBuffer),
779 std::bind(&StockpileSettingsSerializer::write_coins, this, _1, _2));
780 write_cat<StockpileSettings_FinishedGoodsSet>(out, "finished_goods", include_types,
781 mSettings->flags.whole,
782 mSettings->flags.mask_finished_goods,
783 std::bind(&StockpileSettings::mutable_finished_goods, &mBuffer),
784 std::bind(&StockpileSettingsSerializer::write_finished_goods, this, _1, _2));
785 write_cat<StockpileSettings_FoodSet>(out, "food", include_types,
786 mSettings->flags.whole,
787 mSettings->flags.mask_food,
788 std::bind(&StockpileSettings::mutable_food, &mBuffer),
789 std::bind(&StockpileSettingsSerializer::write_food, this, _1, _2));
790 write_cat<StockpileSettings_FurnitureSet>(out, "furniture", include_types,
791 mSettings->flags.whole,
792 mSettings->flags.mask_furniture,
793 std::bind(&StockpileSettings::mutable_furniture, &mBuffer),
794 std::bind(&StockpileSettingsSerializer::write_furniture, this, _1, _2));
795 write_cat<StockpileSettings_GemsSet>(out, "gems", include_types,

Callers 1

debug.cppFile · 0.45

Calls 4

c_strMethod · 0.80
bitfield_to_stringFunction · 0.50
writeFunction · 0.50
printMethod · 0.45

Tested by

no test coverage detected