diff options
| author | Ray <raysan5@gmail.com> | 2018-10-10 23:44:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-10 23:44:20 +0200 |
| commit | b8b8e6ab7d925a88250b92d793b07b74e73d795d (patch) | |
| tree | 4a8aaee09054315f3565abc00408944ed6658797 | |
| parent | 4a4efaa25e2dfeaf9e6cd3f6166db086641288f3 (diff) | |
| parent | 7f7f3b7cd531cdb1a52e75e364c5447653ebddb4 (diff) | |
| download | raylib-b8b8e6ab7d925a88250b92d793b07b74e73d795d.tar.gz raylib-b8b8e6ab7d925a88250b92d793b07b74e73d795d.zip | |
Merge pull request #656 from noshbar/vs2017-fix
Physac.h fix for variable array size declaration.
| -rw-r--r-- | src/physac.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/physac.h b/src/physac.h index ab975e28..038361a4 100644 --- a/src/physac.h +++ b/src/physac.h @@ -606,7 +606,7 @@ PHYSACDEF void PhysicsShatter(PhysicsBody body, Vector2 position, float force) { int count = vertexData.vertexCount; Vector2 bodyPos = body->position; - Vector2 vertices[count]; + Vector2 *vertices = (Vector2*)malloc(sizeof(Vector2) * count); Mat2 trans = body->shape.transform; for (int i = 0; i < count; i++) vertices[i] = vertexData.positions[i]; @@ -698,6 +698,8 @@ PHYSACDEF void PhysicsShatter(PhysicsBody body, Vector2 position, float force) // Apply force to new physics body PhysicsAddForce(newBody, forceDirection); } + + free(vertices); } } } |
