Fix Path Tiling tool rally confusion and crash

If the path being planned by the Path Tiling tool overlaps itself such
that a later rally intersects an earlier line, attempting to interact
with this later rally caused the UI to instead select the rally
associated with the earlier line. This at best leads to user confusion
and at worst leads to a crash if they then drag the rally over another
rally.

This commit fixes the UI logic to correctly identify the rally being
clicked on.
This commit is contained in:
Ashley Newson
2025-05-21 01:11:44 +01:00
committed by Gustas Kažukauskas
parent c6ed381085
commit 561466d822

View File

@@ -106,10 +106,12 @@ namespace OpenRA.Mods.Common.Widgets
var isInside = points.Select(p => p.CPos).Contains(cpos);
var isRally = plan.Rallies.Contains(cpos);
var rallyIndex =
points
.Where(p => p.CPos == cpos)
.Select(p => p.RallyIndex)
.FirstOrDefault(0);
isRally
? plan.Rallies.TakeWhile(r => r != cpos).Count()
: points
.Where(p => p.CPos == cpos)
.Select(p => p.RallyIndex)
.FirstOrDefault(0);
var isStartDirector =
plan.AutoStart != Direction.None
&& cpos == plan.FirstPoint - plan.AutoStart.ToCVec();