Order the vehicle list the way the old starter did

It listed textures by file name and left the ordering to Delphi's Sorted, which
is AnsiCompareText - case-insensitive and locale aware, not ordinal.
This commit is contained in:
maj00r
2026-09-04 23:36:00 +02:00
parent 392d9e7b6a
commit 10523a500a

View File

@@ -314,8 +314,7 @@ public sealed class VehicleBrowser
var matched = _db.Textures var matched = _db.Textures
.Where(t => PassesFilters(t, search, hasSearch)) .Where(t => PassesFilters(t, search, hasSearch))
.OrderBy(BrowserName, StringComparer.OrdinalIgnoreCase) .OrderBy(t => Consist.Base(t.Skinfile), TextureOrder)
.ThenBy(t => t.Skinfile, StringComparer.OrdinalIgnoreCase)
.Take(MaxListRows) .Take(MaxListRows)
.ToList(); .ToList();
@@ -471,8 +470,7 @@ public sealed class VehicleBrowser
return _db.Textures return _db.Textures
.Where(t => PassesFilters(t, search, hasSearch)) .Where(t => PassesFilters(t, search, hasSearch))
.OrderBy(BrowserName, StringComparer.OrdinalIgnoreCase) .OrderBy(t => Consist.Base(t.Skinfile), TextureOrder)
.ThenBy(t => t.Skinfile, StringComparer.OrdinalIgnoreCase)
.ToList(); .ToList();
} }
@@ -505,10 +503,12 @@ public sealed class VehicleBrowser
|| C(t.Meta?.Vehicle) || C(t.Meta?.Operator) || C(VehicleInfo.ClassOf(t)); || C(t.Meta?.Vehicle) || C(t.Meta?.Operator) || C(VehicleInfo.ClassOf(t));
} }
/// <summary> // The old starter listed textures by file name and left the ordering to
/// The name the list row carries, and the key it is sorted on - the two have // Delphi's Sorted, which is AnsiCompareText: case-insensitive and locale
/// to be the same string or the list reads as unordered. // aware. Ordinal comparison puts digits, underscores and accented letters
/// </summary> // somewhere else entirely, which is why the list looked reshuffled.
private static readonly StringComparer TextureOrder = StringComparer.CurrentCultureIgnoreCase;
private static string BrowserName(VehicleTexture texture) private static string BrowserName(VehicleTexture texture)
{ {
if (!string.IsNullOrEmpty(texture.TextureMini) && if (!string.IsNullOrEmpty(texture.TextureMini) &&