Fixed invalid left/right normal errors during level generation (I think). The voronoi cell generation logic ignored zero-length edges, but it was possible for an edge to be so short that the distance from the adjacent edge to the center of the short edge rounded down to zero in GenerateWallShapes.
This commit is contained in:
@@ -183,7 +183,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (GraphEdge ge in graphEdges)
|
||||
{
|
||||
if (ge.point1 == ge.point2) continue;
|
||||
if (Vector2.DistanceSquared(ge.point1, ge.point2) < 0.001f) continue;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
|
||||
@@ -211,16 +211,16 @@ namespace Voronoi2
|
||||
|
||||
public VoronoiCell AdjacentCell(VoronoiCell cell)
|
||||
{
|
||||
if (cell1==cell)
|
||||
if (cell1 == cell)
|
||||
{
|
||||
return cell2;
|
||||
}
|
||||
else if (cell2==cell)
|
||||
else if (cell2 == cell)
|
||||
{
|
||||
return cell1;
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -239,6 +239,11 @@ namespace Voronoi2
|
||||
|
||||
return normal;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "GraphEdge (" + point1.ToString() + ", " + point2.ToString() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
// للترتيب
|
||||
|
||||
Reference in New Issue
Block a user