DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.86k stars 470 forks source link

Manipulator displays squad from previous fort against migrants in current fort #1647

Open ryanbennitt opened 4 years ago

ryanbennitt commented 4 years ago

I retired my fort, started a new fort in same world and some of my old dwarfs from the retired fort turn up as migrants. When you look at them in Manipulator it shows the name of the squad they were assigned to in the retired fort. My new fort doesn't even have any squads configured yet.

lethosor commented 4 years ago

Squads appear to be stored in the world, not in individual forts. I suspect you'd be able to find the relevant squad in world.squads.all, e.g. with df.squad.find(unit.squad_id). I'm not sure how to determine which fort a squad is part of, although squads do have an entity_id field that refers to a historical_entity. Units::getSquadName(), which manipulator uses, doesn't check it. I assume viewing these dwarves with the v menu doesn't show a squad name at all, right?

ryanbennitt commented 4 years ago

Actually under view unit, it does indeed list the old squad from the previous fort. Curiouser and curiouser...

lethosor commented 4 years ago

Sounds similar to https://www.bay12games.com/dwarves/mantisbt/view.php?id=10718 (and https://www.bay12games.com/dwarves/mantisbt/view.php?id=5259, which is older).

ryanbennitt commented 4 years ago

Yep, sounds like it's a general DF issue.

lethosor commented 4 years ago

To clarify, I think it depends on whether squad IDs are intended to be cleared on migrants. If they're intentionally not cleared, then both this and the DF issue are related display issues (i.e. both places need to actually check the squad and see if it's relevant before displaying it). I don't actually know what the intended behavior is, though - there may be a reason on DF's end that squad IDs can't be automatically cleared that I'm unaware of.