Fix getVisibleName for units with identities

As of 0.44.11 (possibly 0.44.01), identity names take precedence over the
associated histfig names. Tested with:

https://drive.google.com/file/d/1bX5CQMqNsb_mjJOEOS4wBm4mGDLLs_cZ/view (#1279)
http://dffd.bay12games.com/file.php?id=13428 (from http://www.bay12games.com/dwarves/mantisbt/view.php?id=10530)

Fixes #1279
develop
lethosor 2018-07-06 11:03:28 -04:00
parent d1a3f1a738
commit 54cf8b7dc3
2 changed files with 2 additions and 7 deletions

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
# Future
## Fixes
- Fixed displayed names (from ``Units::getVisibleName``) for units with identities
- `fix/dead-units`: fixed script trying to use missing isDiplomat function
## Misc Improvements

@ -219,15 +219,9 @@ df::language_name *Units::getVisibleName(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
// as of 0.44.11, identity names take precedence over associated histfig names
if (auto identity = getIdentity(unit))
{
auto id_hfig = df::historical_figure::find(identity->histfig_id);
if (id_hfig)
return &id_hfig->name;
return &identity->name;
}
return &unit->name;
}