Fix tooltips in the Encyclopedia.

If multiple tooltips are defined with conditionals attached, the Encyclopedia could not handle this. Now, it selects the tooltip EnabledByDefault to match usage across the rest of the code.
This commit is contained in:
RoosterDragon
2024-08-06 19:58:48 +01:00
committed by Matthias Mailänder
parent 00203201f4
commit a2edc82b0c

View File

@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
() => SelectActor(actor));
var label = item.Get<LabelWithTooltipWidget>("TITLE");
var name = actor.TraitInfoOrDefault<TooltipInfo>()?.Name;
var name = actor.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault)?.Name;
if (!string.IsNullOrEmpty(name))
WidgetUtils.TruncateLabelToTooltip(label, TranslationProvider.GetString(name));