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

Method read_cloth

plugins/stockpiles/StockpileSerializer.cpp:1379–1441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379void StockpileSettingsSerializer::read_cloth(color_ostream& out, DeserializeMode mode, const vector<string>& filters) {
1380 auto & pcloth = mSettings->cloth;
1381 read_category<StockpileSettings_ClothSet>(out, "cloth", mode,
1382 std::bind(&StockpileSettings::has_cloth, mBuffer),
1383 std::bind(&StockpileSettings::cloth, mBuffer),
1384 mSettings->flags.whole,
1385 mSettings->flags.mask_cloth,
1386 [&]() {
1387 pcloth.thread_silk.clear();
1388 pcloth.thread_yarn.clear();
1389 pcloth.thread_plant.clear();
1390 pcloth.thread_metal.clear();
1391 pcloth.cloth_silk.clear();
1392 pcloth.cloth_plant.clear();
1393 pcloth.cloth_yarn.clear();
1394 pcloth.cloth_metal.clear();
1395 pcloth.dyed = false;
1396 pcloth.undyed = false;
1397 pcloth.color.clear();
1398 },
1399 [&](bool all, char val) {
1400 auto & bcloth = mBuffer.cloth();
1401
1402 unserialize_list_organic_mat(out, "thread/silk", all, val, filters,
1403 [&](size_t idx) -> string { return bcloth.thread_silk(idx); },
1404 bcloth.thread_silk_size(), pcloth.thread_silk, organic_mat_category::Silk);
1405
1406 unserialize_list_organic_mat(out, "thread/plant", all, val, filters,
1407 [&](size_t idx) -> string { return bcloth.thread_plant(idx); },
1408 bcloth.thread_plant_size(), pcloth.thread_plant, organic_mat_category::PlantFiber);
1409
1410 unserialize_list_organic_mat(out, "thread/yarn", all, val, filters,
1411 [&](size_t idx) -> string { return bcloth.thread_yarn(idx); },
1412 bcloth.thread_yarn_size(), pcloth.thread_yarn, organic_mat_category::Yarn);
1413
1414 unserialize_list_organic_mat(out, "thread/metal", all, val, filters,
1415 [&](size_t idx) -> string { return bcloth.thread_metal(idx); },
1416 bcloth.thread_metal_size(), pcloth.thread_metal, organic_mat_category::MetalThread);
1417
1418 unserialize_list_organic_mat(out, "cloth/silk", all, val, filters,
1419 [&](size_t idx) -> string { return bcloth.cloth_silk(idx); },
1420 bcloth.cloth_silk_size(), pcloth.cloth_silk, organic_mat_category::Silk);
1421
1422 unserialize_list_organic_mat(out, "cloth/plant", all, val, filters,
1423 [&](size_t idx) -> string { return bcloth.cloth_plant(idx); },
1424 bcloth.cloth_plant_size(), pcloth.cloth_plant, organic_mat_category::PlantFiber);
1425
1426 unserialize_list_organic_mat(out, "cloth/yarn", all, val, filters,
1427 [&](size_t idx) -> string { return bcloth.cloth_yarn(idx); },
1428 bcloth.cloth_yarn_size(), pcloth.cloth_yarn, organic_mat_category::Yarn);
1429
1430 unserialize_list_organic_mat(out, "cloth/metal", all, val, filters,
1431 [&](size_t idx) -> string { return bcloth.cloth_metal(idx); },
1432 bcloth.cloth_metal_size(), pcloth.cloth_metal, organic_mat_category::MetalThread);
1433
1434 unserialize_list_color(out, "cloth/color", all, val, filters,
1435 [&](size_t idx) -> string { return bcloth.color(idx); },
1436 bcloth.color_size(), pcloth.color);

Callers

nothing calls this directly

Calls 5

unserialize_list_colorFunction · 0.85
set_flagFunction · 0.85
clearMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected