Use HashSets instead of .Distinct

And don't cast to array / list where unnecessary
This commit is contained in:
Gustas
2024-01-22 15:02:53 +02:00
committed by atlimit8
parent 53e4d0dd87
commit 6026d088c8
6 changed files with 12 additions and 13 deletions

View File

@@ -112,9 +112,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
requiredWidget.IsVisible = () => p.Value.Required;
var sourceWidget = container.Get<ImageWidget>("SOURCE");
var sourceTitles = p.Value.Sources.Select(s => sources[s].Title).Distinct().ToList();
var sourceList = sourceTitles.JoinWith("\n");
var isSourceAvailable = sourceTitles.Count != 0;
var sourceList = p.Value.Sources.Select(s => sources[s].Title).Distinct().JoinWith("\n");
var isSourceAvailable = sourceList.Length != 0;
sourceWidget.GetTooltipText = () => sourceList;
sourceWidget.IsVisible = () => isSourceAvailable;