mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
fixed crash in Make Sector mode on empty map
This commit is contained in:
parent
c184901b5e
commit
d514c8837a
1 changed files with 27 additions and 24 deletions
|
@ -144,39 +144,42 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
// Highlighting from a new sidedef?
|
// Highlighting from a new sidedef?
|
||||||
Linedef nl = General.Map.Map.NearestLinedef(mousemappos);
|
Linedef nl = General.Map.Map.NearestLinedef(mousemappos);
|
||||||
float side = nl.SideOfLine(mousemappos);
|
if(nl != null)
|
||||||
newnearest = new LinedefSide(nl, (side <= 0.0f));
|
|
||||||
if(newnearest != nearestside)
|
|
||||||
{
|
{
|
||||||
// Only change when buttons are not pressed
|
float side = nl.SideOfLine(mousemappos);
|
||||||
if(!buttonspressed || (editside == newnearest))
|
newnearest = new LinedefSide(nl, (side <= 0.0f));
|
||||||
|
if(newnearest != nearestside)
|
||||||
{
|
{
|
||||||
// Find new sector
|
// Only change when buttons are not pressed
|
||||||
General.Interface.SetCursor(Cursors.AppStarting);
|
if(!buttonspressed || (editside == newnearest))
|
||||||
nearestside = newnearest;
|
|
||||||
allsides = Tools.FindPotentialSectorAt(mousemappos);
|
|
||||||
if(allsides != null)
|
|
||||||
{
|
{
|
||||||
alllines = new List<Linedef>(allsides.Count);
|
// Find new sector
|
||||||
foreach(LinedefSide sd in allsides) alllines.Add(sd.Line);
|
General.Interface.SetCursor(Cursors.AppStarting);
|
||||||
|
nearestside = newnearest;
|
||||||
|
allsides = Tools.FindPotentialSectorAt(mousemappos);
|
||||||
|
if(allsides != null)
|
||||||
|
{
|
||||||
|
alllines = new List<Linedef>(allsides.Count);
|
||||||
|
foreach(LinedefSide sd in allsides) alllines.Add(sd.Line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alllines = null;
|
||||||
|
}
|
||||||
|
General.Interface.SetCursor(Cursors.Default);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Don't highlight this one
|
||||||
|
nearestside = null;
|
||||||
|
allsides = null;
|
||||||
alllines = null;
|
alllines = null;
|
||||||
}
|
}
|
||||||
General.Interface.SetCursor(Cursors.Default);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Don't highlight this one
|
|
||||||
nearestside = null;
|
|
||||||
allsides = null;
|
|
||||||
alllines = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Redraw overlay
|
// Redraw overlay
|
||||||
DrawGeometry();
|
DrawGeometry();
|
||||||
renderer.Present();
|
renderer.Present();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue