cpSpaceAddCollisionHandler compiler warning question

302 views Asked by At

I have the following in my program (which seems to be working perfectly), but causes a compiler warning:

Passing argument 7 of cpSpaceAddCollisionHandler from incompatible pointer type.

cpSpaceAddCollisionHandler(space, COLLISION_TYPE_BALL, COLLISION_TYPE_LEFT_WALL, collisionBallWallBegin, nil, nil, collisionBallWallEnd, self);

collisionBallWallBegin does not cause this warning and the two methods are declared the same:

static int collisionBallWallBegin (cpArbiter *arb, cpSpace *space, void *data) 

and

static int collisionBallWallEnd(cpArbiter *arb, cpSpace *space, void *data) 

I can't figure out why I am getting the warning and it is driving me nuts!

1

There are 1 answers

1
Anon. On

begin needs to be a cpCollisionBeginFunc, which takes three arguments and returns a cpBool.

In comparison, separate needs to be a cpCollisionSeparateFunc, which takes three arguments and does not return a value.