summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-11-09 18:52:16 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-11-09 18:52:16 +0000
commit5d465e1c04ef666de484e921e8d5e56cc1d25d36 (patch)
treed1eebfa986e179d8129c2c950e17f0162c970cdf
parent5169b73515105f484d5af42e072e740e380a40fc (diff)
ephysics: check for side value on anchors full add
function SVN revision: 79037
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h1
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 8c33af4ac5..72a52ddba0 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -1838,6 +1838,7 @@ typedef enum _EPhysics_Body_Cloth_Anchor_Side
1838 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_RIGHT, 1838 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_RIGHT,
1839 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_TOP, 1839 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_TOP,
1840 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_BOTTOM, 1840 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_BOTTOM,
1841 EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_LAST,
1841} EPhysics_Body_Cloth_Anchor_Side; 1842} EPhysics_Body_Cloth_Anchor_Side;
1842 1843
1843/** 1844/**
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 3a3c7f379c..0c1ab02baa 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -1484,6 +1484,12 @@ ephysics_body_cloth_anchor_full_add(EPhysics_Body *body1, EPhysics_Body *body2,
1484 return; 1484 return;
1485 } 1485 }
1486 1486
1487 if ((side < 0) || (side >= EPHYSICS_BODY_CLOTH_ANCHOR_SIDE_LAST))
1488 {
1489 ERR("Could not add anchors, side is invalid.");
1490 return;
1491 }
1492
1487 rows = body1->cloth_rows + 1; 1493 rows = body1->cloth_rows + 1;
1488 columns = body1->cloth_columns + 1; 1494 columns = body1->cloth_columns + 1;
1489 anchor_mass = body1->soft_body->m_nodes.size() * 0.025; 1495 anchor_mass = body1->soft_body->m_nodes.size() * 0.025;