don't include dead citizens in the citizens list

develop
Myk Taylor 2023-07-18 23:09:19 -07:00
parent c5152dea98
commit 0d81f5ce6e
No known key found for this signature in database
3 changed files with 3 additions and 3 deletions

@ -41,6 +41,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- Fix extra keys appearing in DFHack text boxes when shift (or any other modifier) is released before the other key you were pressing
- `logistics`: don't autotrain domestic animals brought by invaders (they'll get attacked by friendly creatures as soon as you let them out of their cage)
- `logistics`: don't bring trade goods to depot if the only caravans present are tribute caravans
- `gui/create-item`: when choosing a citizen to create the chosen items, avoid choosing a dead citizen
## Misc Improvements
- `stockpiles`: include exotic pets in the "tameable" filter

@ -1454,8 +1454,7 @@ Units module
* ``dfhack.units.getCitizens([ignore_sanity])``
Returns a table (list) of all citizens, which you would otherwise have to
loop over all units in world and test against ``isCitizen()`` to discover.
Returns a list of all living citizens.
* ``dfhack.units.teleport(unit, pos)``

@ -841,7 +841,7 @@ df::unit *Units::getUnitByNobleRole(string noble) {
bool Units::getCitizens(std::vector<df::unit *> &citizens, bool ignore_sanity) {
for (auto &unit : world->units.active) {
if (isCitizen(unit, ignore_sanity))
if (isCitizen(unit, ignore_sanity) && isAlive(unit))
citizens.emplace_back(unit);
}
return true;