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

Function bucket_tree

plugins/autochop.cpp:322–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322static void bucket_tree(df::plant *plant, bool designate_clearcut, bool *designated, bool *can_chop,
323 map<int32_t, int32_t> *tree_counts, map<int32_t, int32_t> *designated_tree_counts,
324 map<int, PersistentDataItem *> &clearcut_burrows,
325 map<int, PersistentDataItem *> &chop_burrows) {
326 for (auto &burrow : plotinfo->burrows.list) {
327 if (!Burrows::isAssignedTile(burrow, plant->pos))
328 continue;
329
330 int id = burrow->id;
331 if (tree_counts)
332 ++(*tree_counts)[id];
333
334 if (*designated) {
335 if (designated_tree_counts)
336 ++(*designated_tree_counts)[id];
337 } else if (clearcut_burrows.count(id) && !is_protected(plant, *clearcut_burrows[id])) {
338 if (designate_clearcut && Designations::markPlant(plant)) {
339 *designated = true;
340 if (designated_tree_counts)
341 ++(*designated_tree_counts)[id];
342 }
343 } else if (chop_burrows.count(id) && !is_protected(plant, *chop_burrows[id])) {
344 *can_chop = true;
345 }
346 }
347
348 if (!*designated && chop_burrows.empty())
349 *can_chop = true;
350}
351
352static void bucket_watched_burrows(color_ostream & out,
353 map<int, PersistentDataItem *> &clearcut_burrows,

Callers 1

scan_treeFunction · 0.85

Calls 4

isAssignedTileFunction · 0.85
is_protectedFunction · 0.85
countMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected