Skip to content
Snippets Groups Projects
Commit a7791754 authored by biwa's avatar biwa
Browse files

Draw Grid Mode: fixed a crash when locking sliced while using a rotated grid

parent 722c79d8
No related branches found
No related tags found
No related merge requests found
......@@ -350,7 +350,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// No shape
if(s == e) return new List<Vector2D[]>();
// Setup slices
// Setup slices. Need to do some extra mathy stuff the make sure the rotated grid is taken into account
switch(gridlockmode)
{
case GridLockMode.NONE:
......@@ -359,18 +359,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
break;
case GridLockMode.HORIZONTAL:
slicesH = width / General.Map.Grid.GridSize;
slicesH = Convert.ToInt32(Math.Ceiling(Math.Abs(width) / (double)General.Map.Grid.GridSize));
slicesV = verticalslices;
break;
case GridLockMode.VERTICAL:
slicesH = horizontalslices;
slicesV = Math.Abs(height / General.Map.Grid.GridSize);
slicesV = Convert.ToInt32(Math.Ceiling(Math.Abs(height) / (double)General.Map.Grid.GridSize));
break;
case GridLockMode.BOTH:
slicesH = Math.Abs(width / General.Map.Grid.GridSize);
slicesV = Math.Abs(height / General.Map.Grid.GridSize);
slicesH = Convert.ToInt32(Math.Ceiling(Math.Abs(width) / (double)General.Map.Grid.GridSize));
slicesV = Convert.ToInt32(Math.Ceiling(Math.Abs(height) / (double)General.Map.Grid.GridSize));
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment