Snapshot for release 2026.10.19.1 (internal f0bdcf8)
This commit is contained in:
parent
5419838250
commit
39de36d3af
131 changed files with 11266 additions and 520 deletions
|
|
@ -143,6 +143,22 @@ internal sealed class Atlas
|
|||
|
||||
// ── Search ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// "a || b || c": the first candidate that is coordinates, or that names a place on the map as a
|
||||
/// whole word or more (<see cref="MatchScore"/> 60+: "Mite Maze" yes, "Bur" inside "Burun" no),
|
||||
/// so a loose candidate never picks an unrelated place. Null when none does.
|
||||
/// </summary>
|
||||
public string? FirstOnMap(string alternatives, bool hasPos, double ns, double ew)
|
||||
{
|
||||
foreach (string raw in alternatives.Split("||", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
|
||||
{
|
||||
if (NavCoords.TrySplitCoordsAndName(raw, out _, out _, out _)) return raw;
|
||||
AtlasLocation? best = FindBest(raw, hasPos, ns, ew);
|
||||
if (best != null && MatchScore(best.Name, raw) >= 60) return raw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>How well <paramref name="name"/> matches <paramref name="q"/> (lower case): 0 = not at all.</summary>
|
||||
public static int MatchScore(string name, string q)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue