| 1792 | } |
| 1793 | |
| 1794 | void StockpileSettingsSerializer::read_food(color_ostream& out, DeserializeMode mode, const vector<string>& filters) { |
| 1795 | using df::enums::organic_mat_category::organic_mat_category; |
| 1796 | using traits = df::enum_traits<organic_mat_category>; |
| 1797 | |
| 1798 | auto & pfood = mSettings->food; |
| 1799 | read_category<StockpileSettings_FoodSet>(out, "food", mode, |
| 1800 | std::bind(&StockpileSettings::has_food, mBuffer), |
| 1801 | std::bind(&StockpileSettings::food, mBuffer), |
| 1802 | mSettings->flags.whole, |
| 1803 | mSettings->flags.mask_food, |
| 1804 | [&]() { |
| 1805 | pfood.prepared_meals = false; |
| 1806 | for (int32_t mat_category = traits::first_item_value; mat_category < traits::last_item_value; ++mat_category) { |
| 1807 | food_pair p = food_map((organic_mat_category)mat_category); |
| 1808 | if (!p.valid) |
| 1809 | continue; |
| 1810 | p.stockpile_values->clear(); |
| 1811 | } |
| 1812 | }, |
| 1813 | [&](bool all, char val) { |
| 1814 | auto & bfood = mBuffer.food(); |
| 1815 | |
| 1816 | set_flag(out, "preparedmeals", filters, all, val, bfood.prepared_meals(), pfood.prepared_meals); |
| 1817 | |
| 1818 | for (int32_t mat_category = traits::first_item_value; mat_category < traits::last_item_value; ++mat_category) { |
| 1819 | food_pair p = food_map((organic_mat_category)mat_category); |
| 1820 | if (!p.valid) |
| 1821 | continue; |
| 1822 | unserialize_list_organic_mat(out, p.name, all, val, filters, |
| 1823 | p.get_value, p.serialized_count, *p.stockpile_values, |
| 1824 | (organic_mat_category)mat_category); |
| 1825 | } |
| 1826 | }); |
| 1827 | } |
| 1828 | |
| 1829 | static bool furniture_mat_is_allowed(const MaterialInfo& mi) { |
| 1830 | return mi.isValid() && mi.material && (mi.material->flags.is_set(material_flags::IS_METAL) || mi.material->flags.is_set(material_flags::IS_STONE)); |
nothing calls this directly
no test coverage detected