From 68f18913cba2fb3e8854c8bae9e122eb09cce841 Mon Sep 17 00:00:00 2001 From: ChromaCat248 Date: Tue, 5 Dec 2023 10:22:57 -0500 Subject: [PATCH] fix my fix --- Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs b/Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs index e071e59c..c6690f04 100644 --- a/Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs +++ b/Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs @@ -163,12 +163,10 @@ public void OnMouseDown(CourseAreaEditContext ctx, LevelViewport viewport) int segmentCount = rail.Points.Count; - if (!rail.IsClosed) + if (!rail.IsClosed && rail.Points.Any()) { segmentCount--; - var delta = rail.Points.Any() ? - Vector3.Distance(rail.Points[0].Position, pos): - 0; + var delta = Vector3.Distance(rail.Points[0].Position, pos); if (delta < min.delta) min = (delta, 1); } @@ -188,7 +186,7 @@ public void OnMouseDown(CourseAreaEditContext ctx, LevelViewport viewport) } DeselectAll(ctx); - InsertPoint(ctx, new BGUnitRail.RailPoint(rail, pos), rail.Points.Count); + InsertPoint(ctx, new BGUnitRail.RailPoint(rail, pos), min.index); } else {