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

Function citizensRange

library/include/modules/Units.h:200–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198DFHACK_EXPORT df::unit *getUnitByNobleRole(std::string noble);
199
200inline auto citizensRange(std::vector<df::unit *> &vec, bool exclude_residents = false, bool include_insane = false) {
201 return vec | std::views::filter([=](df::unit *unit) {
202 if (isDead(unit) || !isActive(unit))
203 return false;
204 return isCitizen(unit, include_insane) ||
205 (!exclude_residents && isResident(unit, include_insane));
206 });
207}
208
209DFHACK_EXPORT void forCitizens(std::function<void(df::unit *)> fn, bool exclude_residents = false, bool include_insane = false);
210DFHACK_EXPORT bool getCitizens(std::vector<df::unit *> &citizens, bool exclude_residents = false, bool include_insane = false);

Callers 5

forCitizensMethod · 0.85
getCitizensMethod · 0.85
df_createitemFunction · 0.85
scan_replacementsMethod · 0.85
revfloodFunction · 0.85

Calls 1

filterFunction · 0.85

Tested by

no test coverage detected