Commits

minz  committed 1078fef

correct some bugs

  • Participants
  • Parent commits 2102fd0
  • Branches physics

Comments (0)

Files changed (5)

 		PG_AddBodyToWorld(s_world,body[i]);
 	}
 
-	PG_Set_Vector2(body[BODY_NUM]->vecLinearVelocity,50,0)
+	body1 = PG_BodyNew();
+	PG_Set_Vector2(body1->vecPosition,50, 0);
+	body1->bStatic = 1;
+	PG_Bind_RectShape(body1, 20, 300, 0);
+	PG_AddBodyToWorld(s_world, body1);
+
+	PG_Set_Vector2(body[BODY_NUM]->vecLinearVelocity,100,0)
 
 	i = 0;
 	joint[i] = PG_DistanceJointNew(body[i+1],body[i],0,50,a1,a2);

File src/pgBodyObject.c

 	body->fRestitution = 1.0;
 	body->fRotation = 0.0;
 	body->fTorque = 0.0;
+	body->shape = NULL;
 	PG_Set_Vector2(body->vecForce,0.0,0.0);
 	PG_Set_Vector2(body->vecImpulse,0.0,0.0);
 	PG_Set_Vector2(body->vecLinearVelocity,0.0,0.0);

File src/pgShapeObject.c

 
 void PG_ShapeObjectDestroy(pgShapeObject* shape)
 {
-	shape->Destroy(shape);
+	if(shape != NULL)
+		shape->Destroy(shape);
 }
 
 

File src/pgVector2.c

 Py_complex c_div_complex_with_real(pgVector2 c,double d)
 {
 	Py_complex r;
+	assert(d != 0);
 	r.real = c.real / d;
 	r.imag = c.imag / d;
 	return r;

File src/pgWorldObject.c

 	pgBodyObject* body = (pgBodyObject*)pybody;
 	if(PG_AddBodyToWorld(world,body))
 	{
-		Py_RETURN_TRUE;
+		Py_RETURN_FALSE;
 	}
 	else
 	{
-		Py_RETURN_FALSE;
+		Py_RETURN_TRUE;
 	}
 }