Fall back to the unit type name for [message] captions for nameless units

Fixes #3211.

(cherry-picked from commit 051182fa1c)
This commit is contained in:
Iris Morelle 2018-06-05 04:41:13 -04:00
parent d5f66e229f
commit 7b604c2a89
2 changed files with 7 additions and 1 deletions

View file

@ -232,6 +232,8 @@
access of the image cache.
* [kill] animate=yes no longer scrolls to units through fog or shroud, thus
matching 1.12's behavior again.
* [message] displays the unit type name when a nameless unit speaks and no
custom caption= is specified (fixes #3211).
## Version 1.13.12
### Security fixes

View file

@ -42,7 +42,11 @@ local function get_caption(cfg, speaker)
local caption = cfg.caption
if not caption and speaker ~= nil then
caption = speaker.name or speaker.type_name
if speaker.name ~= nil and tostring(speaker.name):len() > 0 then
caption = speaker.name
else
caption = speaker.__cfg.language_name
end
end
return caption