From da1b54cf1fd4c71e2e00bbaae8c4684832038d79 Mon Sep 17 00:00:00 2001 From: maj00r Date: Fri, 4 Sep 2026 23:05:50 +0200 Subject: [PATCH] Sort the browser list by the name its rows show It was ordered on TextureMini while the row prints the skin name whenever the thumbnail matches the class, so the list looked unsorted. --- StarterNG/Views/Depot/VehicleBrowser.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/StarterNG/Views/Depot/VehicleBrowser.cs b/StarterNG/Views/Depot/VehicleBrowser.cs index bcecf32..56352d3 100644 --- a/StarterNG/Views/Depot/VehicleBrowser.cs +++ b/StarterNG/Views/Depot/VehicleBrowser.cs @@ -314,7 +314,8 @@ public sealed class VehicleBrowser var matched = _db.Textures .Where(t => PassesFilters(t, search, hasSearch)) - .OrderBy(t => t.TextureMini ?? t.Skinfile, StringComparer.OrdinalIgnoreCase) + .OrderBy(BrowserName, StringComparer.OrdinalIgnoreCase) + .ThenBy(t => t.Skinfile, StringComparer.OrdinalIgnoreCase) .Take(MaxListRows) .ToList(); @@ -470,7 +471,8 @@ public sealed class VehicleBrowser return _db.Textures .Where(t => PassesFilters(t, search, hasSearch)) - .OrderBy(t => t.TextureMini ?? t.Skinfile, StringComparer.OrdinalIgnoreCase) + .OrderBy(BrowserName, StringComparer.OrdinalIgnoreCase) + .ThenBy(t => t.Skinfile, StringComparer.OrdinalIgnoreCase) .ToList(); } @@ -503,6 +505,10 @@ public sealed class VehicleBrowser || C(t.Meta?.Vehicle) || C(t.Meta?.Operator) || C(VehicleInfo.ClassOf(t)); } + /// + /// The name the list row carries, and the key it is sorted on - the two have + /// to be the same string or the list reads as unordered. + /// private static string BrowserName(VehicleTexture texture) { if (!string.IsNullOrEmpty(texture.TextureMini) &&