Skip to content

Commit c3f2c91

Browse files
authored
Merge pull request DFHack#5493 from ab9rf/name-no-comma
`Units::getReadableName`: do not add commas to histfigs with no profession
2 parents 02bd218 + 62343fb commit c3f2c91

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Template for new versions:
5656
## New Features
5757

5858
## Fixes
59+
- ``Units::getReadableName`` will no longer append a comma to the names of histfigs with no profession
5960

6061
## Misc Improvements
6162

library/modules/Units.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,14 +1161,16 @@ static string formatReadableName(T *unit_or_hf, const string &prof_name, bool sk
11611161
if (native_name.empty())
11621162
return prof_name;
11631163

1164+
std::string prof_suffix{ (prof_name.size() > 0) ? (", " + prof_name) : "" };
1165+
11641166
if (skip_english)
1165-
return native_name + ", " + prof_name;
1167+
return native_name + prof_suffix;
11661168

11671169
string english_name = Translation::translateName(visible_name, true, true);
11681170
if (english_name.empty())
1169-
return native_name + ", " + prof_name;
1171+
return native_name + prof_suffix;
11701172

1171-
return native_name + " \"" + english_name + "\", " + prof_name;
1173+
return native_name + " \"" + english_name + "\"" + prof_suffix;
11721174
}
11731175

11741176
string Units::getReadableName(df::historical_figure *hf, bool skip_english) {

0 commit comments

Comments
 (0)