Skip to content

Commit

Permalink
Use byte instead
Browse files Browse the repository at this point in the history
There's a hard cap of 8 in box2d.
  • Loading branch information
metalgearsloth committed Feb 1, 2025
1 parent 54af2ac commit ab9ab44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Robust.Shared/Physics/Shapes/Polygon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal record struct Polygon : IPhysShape
[DataField]
public Vector2[] Vertices;

public int VertexCount;
public byte VertexCount;

public Vector2[] Normals;

Expand All @@ -42,13 +42,13 @@ public Polygon(PolygonShape polyShape)

Array.Copy(polyShape.Vertices, Vertices, Vertices.Length);
Array.Copy(polyShape.Normals, Normals, Vertices.Length);
VertexCount = Vertices.Length;
VertexCount = (byte) Vertices.Length;
}

/// <summary>
/// Manually constructed polygon for internal use to take advantage of pooling.
/// </summary>
internal Polygon(Vector2[] vertices, Vector2[] normals, Vector2 centroid, int count)
internal Polygon(Vector2[] vertices, Vector2[] normals, Vector2 centroid, byte count)
{
Unsafe.SkipInit(out this);
Vertices = vertices;
Expand Down Expand Up @@ -109,7 +109,7 @@ public Polygon(Vector2[] vertices)
return;
}

VertexCount = vertices.Length;
VertexCount = (byte) vertices.Length;
Vertices = vertices;
Normals = new Vector2[vertices.Length];
Set(hull);
Expand Down

0 comments on commit ab9ab44

Please sign in to comment.