Fix invalid CachedTransform uses of MapPreview.

This commit is contained in:
Paul Chote
2025-04-17 17:45:48 +01:00
committed by Gustas Kažukauskas
parent e8d710dee4
commit 56c615d890
2 changed files with 10 additions and 11 deletions

View File

@@ -335,12 +335,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (mapTitle != null)
{
var font = Game.Renderer.Fonts[mapTitle.Font];
var title = new CachedTransform<MapPreview, string>(m =>
var title = new CachedTransform<string, string>(t =>
{
var truncated = WidgetUtils.TruncateText(m.Title, mapTitle.Bounds.Width, font);
var truncated = WidgetUtils.TruncateText(t, mapTitle.Bounds.Width, font);
if (m.Title != truncated)
mapTitle.GetTooltipText = () => m.Title;
if (t != truncated)
mapTitle.GetTooltipText = () => t;
else
mapTitle.GetTooltipText = null;
@@ -358,7 +358,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (currentMap.Class == MapClassification.Unknown)
return mapClassificationUnknown;
return title.Update(currentMap);
return title.Update(currentMap.Title);
};
}