From 54cf8b7dc36f1ed1343e202c05b115a42ee6abb5 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 6 Jul 2018 11:03:28 -0400 Subject: [PATCH] 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 --- docs/changelog.txt | 1 + library/modules/Units.cpp | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 083697b3b..eec027a1f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -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 diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index fc2f20c6a..bc8d1ae88 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -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; }