mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-29 15:11:56 +00:00
Linedefs Mode, Sectors Mode, Things Mode: fixed a problem where multi-selecting many spread out map elements could result in an exception. Fixes #1053
This commit is contained in:
parent
d0176253b0
commit
2a404cf1fc
3 changed files with 15 additions and 3 deletions
|
@ -362,7 +362,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(curdistance < closest2) closest2 = curdistance;
|
if(curdistance < closest2) closest2 = curdistance;
|
||||||
|
|
||||||
// Return closer one
|
// Return closer one
|
||||||
return (int)(closest1 - closest2);
|
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
|
||||||
|
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
|
||||||
|
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
|
||||||
|
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
|
||||||
|
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -722,7 +722,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return closer one
|
// Return closer one
|
||||||
return (int)(closest1 - closest2);
|
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
|
||||||
|
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
|
||||||
|
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
|
||||||
|
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
|
||||||
|
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1011,7 +1011,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
double closest2 = Vector2D.DistanceSq(t2.Position, targetpoint);
|
double closest2 = Vector2D.DistanceSq(t2.Position, targetpoint);
|
||||||
|
|
||||||
// Return closer one
|
// Return closer one
|
||||||
return (int)(closest1 - closest2);
|
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
|
||||||
|
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
|
||||||
|
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
|
||||||
|
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
|
||||||
|
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue