use new API in autochop

develop
Myk Taylor 2023-01-29 16:28:56 -08:00
parent 1c6235633f
commit f1e8ee1b0a
No known key found for this signature in database
1 changed files with 4 additions and 11 deletions

@ -369,13 +369,6 @@ static void bucket_tree(df::plant *plant, bool designate_clearcut, bool *designa
*can_chop = true;
}
static void get_citizens(vector<df::unit *> &vec) {
for (auto &unit : world->units.active) {
if (Units::isCitizen(unit))
vec.emplace_back(unit);
}
}
static void bucket_watched_burrows(color_ostream & out,
map<int, PersistentDataItem *> &clearcut_burrows,
map<int, PersistentDataItem *> &chop_burrows) {
@ -546,7 +539,7 @@ static int32_t do_cycle(color_ostream &out, bool force_designate) {
int32_t expected_yield;
TreesBySize designatable_trees_by_size;
vector<df::unit *> citizens;
get_citizens(citizens);
Units::getCitizens(citizens);
int32_t newly_marked = scan_trees(out, &expected_yield,
&designatable_trees_by_size, true, citizens);
@ -634,7 +627,7 @@ static void autochop_printStatus(color_ostream &out) {
int32_t designated_trees, expected_yield, accessible_yield;
map<int32_t, int32_t> tree_counts, designated_tree_counts;
vector<df::unit *> citizens;
get_citizens(citizens);
Units::getCitizens(citizens);
scan_logs(&usable_logs, citizens, &inaccessible_logs);
scan_trees(out, &expected_yield, NULL, false, citizens, &accessible_trees, &inaccessible_trees,
&designated_trees, &accessible_yield, &tree_counts, &designated_tree_counts);
@ -739,7 +732,7 @@ static int autochop_getLogCounts(lua_State *L) {
DEBUG(status,*out).print("entering autochop_getNumLogs\n");
int32_t usable_logs, inaccessible_logs;
vector<df::unit *> citizens;
get_citizens(citizens);
Units::getCitizens(citizens);
scan_logs(&usable_logs, citizens, &inaccessible_logs);
Lua::Push(L, usable_logs);
Lua::Push(L, inaccessible_logs);
@ -778,7 +771,7 @@ static int autochop_getTreeCountsAndBurrowConfigs(lua_State *L) {
int32_t designated_trees, expected_yield, accessible_yield;
map<int32_t, int32_t> tree_counts, designated_tree_counts;
vector<df::unit *> citizens;
get_citizens(citizens);
Units::getCitizens(citizens);
scan_trees(*out, &expected_yield, NULL, false, citizens, &accessible_trees, &inaccessible_trees,
&designated_trees, &accessible_yield, &tree_counts, &designated_tree_counts);