shibbo/Fushigi

Placing first point of wall crashes Fushigi

Closed this issue · 0 comments

Describe the bug
When trying to add a point on a newly created Wall, Fushigi crashes.

Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Fushigi.ui.SceneObjects.bgunit.BGUnitRailSceneObj.OnMouseDown(CourseAreaEditContext ctx, LevelViewport viewport) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\SceneObjects\bgunit\BGUnitRailSceneObj.cs:line 169
   at Fushigi.ui.SceneObjects.bgunit.BGUnitRailSceneObj.Fushigi.ui.widgets.IViewportDrawable.Draw2D(CourseAreaEditContext ctx, LevelViewport viewport, ImDrawListPtr dl, Boolean& isNewHoveredObj) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\SceneObjects\bgunit\BGUnitRailSceneObj.cs:line 300
   at Fushigi.ui.widgets.LevelViewport.<>c__DisplayClass46_0.<DrawAreaContent>b__0(IViewportDrawable obj) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\widgets\LevelViewport.cs:line 781
   at Fushigi.ui.CourseAreaScene.ForEach[T](Action`1 action) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\CourseAreaScene.cs:line 153
   at Fushigi.ui.widgets.LevelViewport.DrawAreaContent() in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\widgets\LevelViewport.cs:line 778
   at Fushigi.ui.widgets.LevelViewport.Draw(Vector2 size, Double deltaSeconds, IDictionary`2 layersVisibility) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\widgets\LevelViewport.cs:line 332
   at Fushigi.ui.widgets.CourseScene.DrawUI(GL gl, Double deltaSeconds) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\widgets\CourseScene.cs:line 222
   at Fushigi.ui.MainWindow.Render(GL gl, Double delta, ImGuiController controller) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\MainWindow.cs:line 339
   at Fushigi.windowing.WindowManager.<>c__DisplayClass10_0.<RegisterRenderDelegate>b__1(Double deltaSeconds) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\windowing\WindowManager.cs:line 83
   at Silk.NET.Windowing.Internals.ViewImplementationBase.DoRender()
   at Silk.NET.Windowing.WindowExtensions.<>c__DisplayClass2_0.<Run>b__0()
   at Silk.NET.Windowing.Internals.ViewImplementationBase.Run(Action onFrame)
   at Silk.NET.Windowing.WindowExtensions.Run(IView view)
   at Fushigi.ui.MainWindow..ctor() in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\ui\MainWindow.cs:line 90
   at Program.<Main>$(String[] args) in C:\Users\Aikoyori\Desktop\Games\Fushigi\Fushigi\Program.cs:line 40

To Reproduce
Steps to reproduce the behavior:

  1. Go to Terrain Unit > Add Wall
  2. Select the wall in Terrain Unit Menu
  3. Alt + Click on Viewport to Create a point

Expected behavior
A new point is created and made as first point of the wall.

Actual behavior
Fushigi crashes.

Screenshots

Video of it happening is attached below.

Fushigi_20231204-024317.mp4

Operating System:
Windows 11 23H2 Build 22631.2715

Additional context
This build is compiled from 627002d as a Debug build per instruction in https://github.com/shibbo/Fushigi/blob/627002d5b5694d0f9b660bc1bcbb89a5a5c1591e/README.md#instructions
Note that this worked back on https://github.com/shibbo/Fushigi/releases/tag/v0.6-alpha

Here's a video on v0.6-alpha

Fushigi_20231204-025855.mp4