| 795 | } |
| 796 | |
| 797 | static int autochop_getTreeCountsAndBurrowConfigs(lua_State *L) { |
| 798 | color_ostream *out = Lua::GetOutput(L); |
| 799 | if (!out) |
| 800 | out = &Core::getInstance().getConsole(); |
| 801 | DEBUG(control,*out).print("entering autochop_getTreeCountsAndBurrowConfigs\n"); |
| 802 | validate_burrow_configs(*out); |
| 803 | int32_t accessible_trees, inaccessible_trees; |
| 804 | int32_t designated_trees, expected_yield, accessible_yield; |
| 805 | map<int32_t, int32_t> tree_counts, designated_tree_counts; |
| 806 | vector<df::unit *> citizens; |
| 807 | Units::getCitizens(citizens, true); |
| 808 | scan_trees(*out, &expected_yield, NULL, false, citizens, &accessible_trees, &inaccessible_trees, |
| 809 | &designated_trees, &accessible_yield, &tree_counts, &designated_tree_counts); |
| 810 | |
| 811 | map<string, int32_t> summary; |
| 812 | |
| 813 | map<int32_t, map<string, int32_t>> burrow_config_map; |
| 814 | |
| 815 | summary.emplace("accessible_trees", accessible_trees); |
| 816 | summary.emplace("inaccessible_trees", inaccessible_trees); |
| 817 | summary.emplace("designated_trees", designated_trees); |
| 818 | summary.emplace("expected_yield", expected_yield); |
| 819 | summary.emplace("accessible_yield", accessible_yield); |
| 820 | Lua::Push(L, summary); |
| 821 | |
| 822 | Lua::Push(L, tree_counts); |
| 823 | Lua::Push(L, designated_tree_counts); |
| 824 | |
| 825 | for (auto &burrow : plotinfo->burrows.list) { |
| 826 | int id = burrow->id; |
| 827 | if (watched_burrows_indices.count(id)) |
| 828 | emplace_bulk_burrow_config(L, burrow_config_map, |
| 829 | watched_burrows[watched_burrows_indices[id]]); |
| 830 | else |
| 831 | emplace_bulk_burrow_config(L, burrow_config_map, id); |
| 832 | } |
| 833 | |
| 834 | Lua::Push(L, burrow_config_map); |
| 835 | |
| 836 | return 4; |
| 837 | } |
| 838 | |
| 839 | static int autochop_getBurrowConfig(lua_State *L) { |
| 840 | color_ostream *out = Lua::GetOutput(L); |
nothing calls this directly
no test coverage detected