Merge pull request #3859 from myk002/myk_readable

[zone] label war and hunt trained animals in readable names
develop
Myk 2023-10-09 18:14:03 -07:00 committed by GitHub
commit 4db6f8f3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

@ -66,6 +66,7 @@ Template for new versions:
- `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates - `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates
- `orders`: ``recheck`` command now only resets orders that have conditions that can be rechecked - `orders`: ``recheck`` command now only resets orders that have conditions that can be rechecked
- `sort`: added help button for squad assignment search/filter/sort - `sort`: added help button for squad assignment search/filter/sort
- `zone`: animals trained for war or hunting are now labeled as such in animal assignment screens
## Documentation ## Documentation

@ -1609,7 +1609,8 @@ Units module
* ``dfhack.units.getReadableName(unit)`` * ``dfhack.units.getReadableName(unit)``
Returns a string that includes the language name of the unit (if any), the Returns a string that includes the language name of the unit (if any), the
race of the unit, and any syndrome-given descriptions (such as "necromancer"). race of the unit, whether it is trained for war or hunting, and any
syndrome-given descriptions (such as "necromancer").
* ``dfhack.units.getStressCategory(unit)`` * ``dfhack.units.getStressCategory(unit)``

@ -1267,6 +1267,10 @@ static string get_caste_name(df::unit* unit) {
string Units::getReadableName(df::unit* unit) { string Units::getReadableName(df::unit* unit) {
string race_name = isChild(unit) ? getRaceChildName(unit) : get_caste_name(unit); string race_name = isChild(unit) ? getRaceChildName(unit) : get_caste_name(unit);
if (isHunter(unit))
race_name = "hunter " + race_name;
if (isWar(unit))
race_name = "war " + race_name;
string name = Translation::TranslateName(getVisibleName(unit)); string name = Translation::TranslateName(getVisibleName(unit));
if (name.empty()) { if (name.empty()) {
name = race_name; name = race_name;