mirror of https://github.com/axmolengine/axmol.git
calls `delete[]` instead of `delete`
calls `delete[]` instead of `delete`
This commit is contained in:
parent
51cfd3fb4b
commit
d6446e9b14
|
@ -37,8 +37,10 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
_acceleration = new cocos2d::Acceleration();
|
if( (self = [super init]) ) {
|
||||||
_motionManager = [[CMMotionManager alloc] init];
|
_acceleration = new cocos2d::Acceleration();
|
||||||
|
_motionManager = [[CMMotionManager alloc] init];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -539,7 +539,7 @@ bool PhysicsShapePolygon::init(const Point* points, int count, const PhysicsMate
|
||||||
cpVect* vecs = new cpVect[count];
|
cpVect* vecs = new cpVect[count];
|
||||||
PhysicsHelper::points2cpvs(points, vecs, count);
|
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||||
cpShape* shape = cpPolyShapeNew(_info->getSharedBody(), count, vecs, PhysicsHelper::point2cpv(offset));
|
cpShape* shape = cpPolyShapeNew(_info->getSharedBody(), count, vecs, PhysicsHelper::point2cpv(offset));
|
||||||
CC_SAFE_DELETE(vecs);
|
CC_SAFE_DELETE_ARRAY(vecs);
|
||||||
|
|
||||||
CC_BREAK_IF(shape == nullptr);
|
CC_BREAK_IF(shape == nullptr);
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ float PhysicsShapePolygon::calculateArea(const Point* points, int count)
|
||||||
cpVect* vecs = new cpVect[count];
|
cpVect* vecs = new cpVect[count];
|
||||||
PhysicsHelper::points2cpvs(points, vecs, count);
|
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||||
float area = PhysicsHelper::cpfloat2float(cpAreaForPoly(count, vecs));
|
float area = PhysicsHelper::cpfloat2float(cpAreaForPoly(count, vecs));
|
||||||
CC_SAFE_DELETE(vecs);
|
CC_SAFE_DELETE_ARRAY(vecs);
|
||||||
|
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ float PhysicsShapePolygon::calculateMoment(float mass, const Point* points, int
|
||||||
PhysicsHelper::points2cpvs(points, vecs, count);
|
PhysicsHelper::points2cpvs(points, vecs, count);
|
||||||
float moment = mass == PHYSICS_INFINITY ? PHYSICS_INFINITY
|
float moment = mass == PHYSICS_INFINITY ? PHYSICS_INFINITY
|
||||||
: PhysicsHelper::cpfloat2float(cpMomentForPoly(mass, count, vecs, PhysicsHelper::point2cpv(offset)));
|
: PhysicsHelper::cpfloat2float(cpMomentForPoly(mass, count, vecs, PhysicsHelper::point2cpv(offset)));
|
||||||
CC_SAFE_DELETE(vecs);
|
CC_SAFE_DELETE_ARRAY(vecs);
|
||||||
|
|
||||||
return moment;
|
return moment;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue