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

Function autochop_printStatus

plugins/autochop.cpp:623–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621}
622
623static void autochop_printStatus(color_ostream &out) {
624 DEBUG(control,out).print("entering autochop_printStatus\n");
625 validate_burrow_configs(out);
626 out.print("autochop is {}\n\n", is_enabled ? "enabled" : "disabled");
627 out.print(" keeping log counts between {} and {}\n",
628 config.get_int(CONFIG_MIN_LOGS), config.get_int(CONFIG_MAX_LOGS));
629 if (config.get_bool(CONFIG_WAITING_FOR_MIN))
630 out.print(" currently waiting for min threshold to be crossed before designating more trees\n");
631 else
632 out.print(" currently designating trees until max threshold is crossed\n");
633 out.print("\n");
634
635 int32_t usable_logs, inaccessible_logs;
636 int32_t accessible_trees, inaccessible_trees;
637 int32_t designated_trees, expected_yield, accessible_yield;
638 map<int32_t, int32_t> tree_counts, designated_tree_counts;
639 vector<df::unit *> citizens;
640 Units::getCitizens(citizens, true);
641 scan_logs(out, &usable_logs, citizens, &inaccessible_logs);
642 scan_trees(out, &expected_yield, NULL, false, citizens, &accessible_trees, &inaccessible_trees,
643 &designated_trees, &accessible_yield, &tree_counts, &designated_tree_counts);
644
645 out.print("summary:\n");
646 out.print(" accessible logs (usable stock): {}\n", usable_logs);
647 out.print(" inaccessible logs: {}\n", inaccessible_logs);
648 out.print(" total visible logs: {}\n", usable_logs + inaccessible_logs);
649 out.print("\n");
650 out.print(" accessible trees: {}\n", accessible_trees);
651 out.print(" inaccessible trees: {}\n", inaccessible_trees);
652 out.print(" total visible trees: {}\n", accessible_trees + inaccessible_trees);
653 out.print("\n");
654 out.print(" designated trees: {}\n", designated_trees);
655 out.print(" expected logs from designated trees: {}\n", expected_yield);
656 out.print(" expected logs from all accessible trees: {}\n", accessible_yield);
657 out.print("\n");
658 out.print(" total trees harvested: {}\n", plotinfo->trees_removed);
659 out.print("\n");
660
661 if (!plotinfo->burrows.list.size()) {
662 out.print("no burrows defined\n");
663 return;
664 }
665
666 out.print("\n");
667
668 int name_width = 11;
669 for (auto &burrow : plotinfo->burrows.list) {
670 name_width = std::max(name_width, (int)burrow->name.size());
671 }
672
673 constexpr auto fmt = "{:<{}} {:4} {:4} {:8} {:5} {:6} {:7}\n";
674 out.print(fmt, "burrow name", name_width, " id ", "chop", "clearcut", "trees", "marked", "protect");
675 out.print(fmt, "-----------", name_width, "----", "----", "--------", "-----", "------", "-------");
676
677 for (auto &burrow : plotinfo->burrows.list) {
678 bool chop = false;
679 bool clearcut = false;
680 bool protect_brewable = false;

Callers

nothing calls this directly

Calls 7

validate_burrow_configsFunction · 0.85
scan_logsFunction · 0.85
scan_treesFunction · 0.85
get_protect_strFunction · 0.85
printMethod · 0.45
sizeMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected