| 269 | } |
| 270 | |
| 271 | static bool is_protected(const df::plant * plant, PersistentDataItem &c) { |
| 272 | const df::plant_raw *plant_raw = df::plant_raw::find(plant->material); |
| 273 | |
| 274 | bool protect_brewable = c.get_bool(BURROW_CONFIG_PROTECT_BREWABLE); |
| 275 | bool protect_edible = c.get_bool(BURROW_CONFIG_PROTECT_EDIBLE); |
| 276 | bool protect_cookable = c.get_bool(BURROW_CONFIG_PROTECT_COOKABLE); |
| 277 | |
| 278 | if (protect_brewable && plant_raw->material_defs.type[plant_material_def::drink] != -1) |
| 279 | return true; |
| 280 | |
| 281 | if (protect_edible || protect_cookable) { |
| 282 | for (df::material * mat : plant_raw->material) { |
| 283 | if (protect_edible && mat->flags.is_set(material_flags::EDIBLE_RAW)) |
| 284 | return true; |
| 285 | |
| 286 | if (protect_cookable && mat->flags.is_set(material_flags::EDIBLE_COOKED)) |
| 287 | return true; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | return false; |
| 292 | } |
| 293 | |
| 294 | static int32_t estimate_logs(const df::plant *plant) { |
| 295 | if (!plant->tree_info) |
no test coverage detected