| 50 | static std::unordered_set<uint16_t> accessible_walkability_groups; |
| 51 | |
| 52 | void 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 |
no test coverage detected