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

Function update_walkability_groups

plugins/buildingplan/buildingplan_cycle.cpp:52–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50static std::unordered_set<uint16_t> accessible_walkability_groups;
51
52void update_walkability_groups(){
53
54 // ensure that we update at most once per tick
55 auto frame_counter = df::global::world->frame_counter;
56 if (frame_counter == walkability_timestamp)
57 return;
58 else
59 walkability_timestamp = frame_counter;
60
61 accessible_walkability_groups.clear();
62 auto get_group = [](df::unit *unit){
63 auto group = Maps::getWalkableGroup(Units::getPosition(unit));
64 if (group != 0)
65 {
66 accessible_walkability_groups.insert(group);
67 }
68 };
69 Units::forCitizens(get_group);
70}
71
72// This is tricky. we want to choose an item that can be brought to the job site, but that's not
73// necessarily the same as job->pos. it could be many tiles off in any direction (e.g. for bridges), or

Callers 2

scanAvailableItemsFunction · 0.85
buildingplan_cycleFunction · 0.85

Calls 2

clearMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected