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

Method read_armor

plugins/stockpiles/StockpileSerializer.cpp:1188–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1186}
1187
1188void StockpileSettingsSerializer::read_armor(color_ostream& out, DeserializeMode mode, const vector<string>& filters) {
1189 auto & parmor = mSettings->armor;
1190 read_category<StockpileSettings_ArmorSet>(out, "armor", mode,
1191 std::bind(&StockpileSettings::has_armor, mBuffer),
1192 std::bind(&StockpileSettings::armor, mBuffer),
1193 mSettings->flags.whole,
1194 mSettings->flags.mask_armor,
1195 [&]() {
1196 parmor.unusable = false;
1197 parmor.usable = false;
1198 parmor.body.clear();
1199 parmor.head.clear();
1200 parmor.feet.clear();
1201 parmor.hands.clear();
1202 parmor.legs.clear();
1203 parmor.shield.clear();
1204 parmor.other_mats.clear();
1205 parmor.mats.clear();
1206 quality_clear(parmor.quality_core);
1207 quality_clear(parmor.quality_total);
1208 parmor.dyed = false;
1209 parmor.undyed = false;
1210 parmor.color.clear();
1211 },
1212 [&](bool all, char val) {
1213 auto & barmor = mBuffer.armor();
1214
1215 set_flag(out, "nouse", filters, all, val, barmor.unusable(), parmor.unusable);
1216 set_flag(out, "canuse", filters, all, val, barmor.usable(), parmor.usable);
1217
1218 unserialize_list_itemdef(out, "body", all, val, filters,
1219 [&](const size_t& idx) -> const string& { return barmor.body(idx); },
1220 barmor.body_size(), parmor.body, item_type::ARMOR);
1221
1222 unserialize_list_itemdef(out, "head", all, val, filters,
1223 [&](const size_t& idx) -> const string& { return barmor.head(idx); },
1224 barmor.head_size(), parmor.head, item_type::HELM);
1225
1226 unserialize_list_itemdef(out, "feet", all, val, filters,
1227 [&](const size_t& idx) -> const string& { return barmor.feet(idx); },
1228 barmor.feet_size(), parmor.feet, item_type::SHOES);
1229
1230 unserialize_list_itemdef(out, "hands", all, val, filters,
1231 [&](const size_t& idx) -> const string& { return barmor.hands(idx); },
1232 barmor.hands_size(), parmor.hands, item_type::GLOVES);
1233
1234 unserialize_list_itemdef(out, "legs", all, val, filters,
1235 [&](const size_t& idx) -> const string& { return barmor.legs(idx); },
1236 barmor.legs_size(), parmor.legs, item_type::PANTS);
1237
1238 unserialize_list_itemdef(out, "shield", all, val, filters,
1239 [&](const size_t& idx) -> const string& { return barmor.shield(idx); },
1240 barmor.shield_size(), parmor.shield, item_type::SHIELD);
1241
1242 unserialize_list_material(out, "mats", all, val, filters,
1243 armor_mat_is_allowed,
1244 [&](const size_t& idx) -> const string& { return barmor.mats(idx); },
1245 barmor.mats_size(), parmor.mats);

Callers

nothing calls this directly

Calls 9

quality_clearFunction · 0.85
set_flagFunction · 0.85
unserialize_list_itemdefFunction · 0.85
unserialize_list_qualityFunction · 0.85
unserialize_list_colorFunction · 0.85
clearMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected