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:
committed by
Gustas Kažukauskas
parent
c6ed381085
commit
561466d822
@@ -106,10 +106,12 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var isInside = points.Select(p => p.CPos).Contains(cpos);
|
var isInside = points.Select(p => p.CPos).Contains(cpos);
|
||||||
var isRally = plan.Rallies.Contains(cpos);
|
var isRally = plan.Rallies.Contains(cpos);
|
||||||
var rallyIndex =
|
var rallyIndex =
|
||||||
points
|
isRally
|
||||||
.Where(p => p.CPos == cpos)
|
? plan.Rallies.TakeWhile(r => r != cpos).Count()
|
||||||
.Select(p => p.RallyIndex)
|
: points
|
||||||
.FirstOrDefault(0);
|
.Where(p => p.CPos == cpos)
|
||||||
|
.Select(p => p.RallyIndex)
|
||||||
|
.FirstOrDefault(0);
|
||||||
var isStartDirector =
|
var isStartDirector =
|
||||||
plan.AutoStart != Direction.None
|
plan.AutoStart != Direction.None
|
||||||
&& cpos == plan.FirstPoint - plan.AutoStart.ToCVec();
|
&& cpos == plan.FirstPoint - plan.AutoStart.ToCVec();
|
||||||
|
|||||||
Reference in New Issue
Block a user