From 61e44324245a026b895121e4295545ad49a37c31 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 9 Oct 2023 17:24:13 -0700 Subject: [PATCH] label war and hunt trained animals in readable names --- docs/changelog.txt | 1 + docs/dev/Lua API.rst | 3 ++- library/modules/Units.cpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index fbe37deff..8c99c2b57 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -64,6 +64,7 @@ Template for new versions: ## Misc Improvements - `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 +- `zone`: animals trained for war or hunting are now labeled as such in animal assignment screens ## Documentation diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 1d8c2beb6..fd56a11ed 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -1609,7 +1609,8 @@ Units module * ``dfhack.units.getReadableName(unit)`` 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)`` diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index ebfd13b5e..83554ef78 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -1267,6 +1267,10 @@ static string get_caste_name(df::unit* unit) { string Units::getReadableName(df::unit* 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)); if (name.empty()) { name = race_name;