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

Function is_protected

plugins/autochop.cpp:271–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271static 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
294static int32_t estimate_logs(const df::plant *plant) {
295 if (!plant->tree_info)

Callers 1

bucket_treeFunction · 0.85

Calls 2

is_setMethod · 0.80
findFunction · 0.50

Tested by

no test coverage detected