mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-06 21:48:35 +01:00
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:
@@ -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) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user