diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 14:59:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 14:59:29 +0400 |
commit | fb92835819715275e1e8b0dd299a24fc281afd5b (patch) | |
tree | bf6ac0dfa8ad9b6083da0b3d17369424b44a2dbd /source/gameengine/Physics | |
parent | d9b0f660c9e49b13abc212270c0e8a366a2a096f (diff) |
bge: de-duplicate cleanup code for empty mesh error case
Diffstat (limited to 'source/gameengine/Physics')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index 0604157a420..4350ba5d93d 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1590,17 +1590,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, /* Can happen with ngons */ if (!tot_bt_verts) { - m_shapeType = PHY_SHAPE_NONE; - m_meshObject = NULL; - m_vertexArray.clear(); - m_polygonIndexArray.clear(); - m_triFaceArray.clear(); - m_triFaceUVcoArray.clear(); - if (free_dm) { - dm->release(dm); - dm = NULL; - } - return false; + goto cleanup_empty_mesh; } m_vertexArray.resize(tot_bt_verts*3); @@ -1679,17 +1669,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, /* Can happen with ngons */ if (!tot_bt_verts) { - m_shapeType = PHY_SHAPE_NONE; - m_meshObject = NULL; - m_vertexArray.clear(); - m_polygonIndexArray.clear(); - m_triFaceArray.clear(); - m_triFaceUVcoArray.clear(); - if (free_dm) { - dm->release(dm); - dm = NULL; - } - return false; + goto cleanup_empty_mesh; } m_vertexArray.resize(tot_bt_verts*3); @@ -1834,6 +1814,19 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, m_meshShapeMap.insert(std::pair<RAS_MeshObject*,CcdShapeConstructionInfo*>(meshobj,this)); } return true; + + +cleanup_empty_mesh: + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + } + return false; } #include <cstdio> |