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

Method write_armor

plugins/stockpiles/StockpileSerializer.cpp:1111–1186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111bool StockpileSettingsSerializer::write_armor(color_ostream& out, StockpileSettings::ArmorSet* armor) {
1112
1113 auto & parmor = mSettings->armor;
1114 bool all = parmor.unusable && parmor.usable && parmor.dyed && parmor.undyed;
1115
1116 armor->set_unusable(parmor.unusable);
1117 armor->set_usable(parmor.usable);
1118 armor->set_dyed(parmor.dyed);
1119 armor->set_undyed(parmor.undyed);
1120
1121 // armor type
1122 all = serialize_list_itemdef(out,
1123 [&](const string& token) { armor->add_body(token); },
1124 parmor.body,
1125 vector<df::itemdef*>(world->raws.itemdefs.armor.begin(), world->raws.itemdefs.armor.end()),
1126 item_type::ARMOR) && all;
1127
1128 // helm type
1129 all = serialize_list_itemdef(out,
1130 [&](const string& token) { armor->add_head(token); },
1131 parmor.head,
1132 vector<df::itemdef*>(world->raws.itemdefs.helms.begin(), world->raws.itemdefs.helms.end()),
1133 item_type::HELM) && all;
1134
1135 // shoes type
1136 all = serialize_list_itemdef(out,
1137 [&](const string& token) { armor->add_feet(token); },
1138 parmor.feet,
1139 vector<df::itemdef*>(world->raws.itemdefs.shoes.begin(), world->raws.itemdefs.shoes.end()),
1140 item_type::SHOES) && all;
1141
1142 // gloves type
1143 all = serialize_list_itemdef(out,
1144 [&](const string& token) { armor->add_hands(token); },
1145 parmor.hands,
1146 vector<df::itemdef*>(world->raws.itemdefs.gloves.begin(), world->raws.itemdefs.gloves.end()),
1147 item_type::GLOVES) && all;
1148
1149 // pant type
1150 all = serialize_list_itemdef(out,
1151 [&](const string& token) { armor->add_legs(token); },
1152 parmor.legs,
1153 vector<df::itemdef*>(world->raws.itemdefs.pants.begin(), world->raws.itemdefs.pants.end()),
1154 item_type::PANTS) && all;
1155
1156 // shield type
1157 all = serialize_list_itemdef(out,
1158 [&](const string& token) { armor->add_shield(token); },
1159 parmor.shield,
1160 vector<df::itemdef*>(world->raws.itemdefs.shields.begin(), world->raws.itemdefs.shields.end()),
1161 item_type::SHIELD) && all;
1162
1163 // materials
1164 all = serialize_list_material(out,
1165 armor_mat_is_allowed,
1166 [&](const string& token) { armor->add_mats(token); },
1167 parmor.mats) && all;
1168

Callers

nothing calls this directly

Calls 7

serialize_list_itemdefFunction · 0.85
serialize_list_materialFunction · 0.85
serialize_list_qualityFunction · 0.85
serialize_list_colorFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected