Page 1 of 1

ChipmunkObjectFlatten Deprecated?

Posted: Wed Oct 05, 2011 11:49 am
by PDiTO
I'm trying to follow along with the Objective-Chipmunk examples, namely the SimpleObjectiveChipmunk project, but I notice that ChipmunkObjectFlatten has been deprecated in 6.0.2?

Can anyone point me in the right direction as to how to get over this issue?

Thanks.

Re: ChipmunkObjectFlatten Deprecated?

Posted: Wed Oct 05, 2011 1:19 pm
by slembcke
Ah, sorry about that. From the header:

Code: Select all

/// @deprecated since 6.0.2 Use [NSArray arrayWithObjects:] or similar instead.
NSSet * ChipmunkObjectFlatten(id <ChipmunkObject> firstObject, ...) __attribute__((deprecated));
So where you would have done:

Code: Select all

chipmunkObjects = [ChipmunkObjectFlatten(a, b, c, d, e, nil) retain];
Do one of this instead:

Code: Select all

chipmunkObjects = [[NSArray alloc] initWithObjects:a, b, c, d, e, nil];
The Chipmunk Object protocol was modified to work with any nested NSFastEnumeration objects (NSArray, NSSet, etc) instead of only the flattened NSSets that the ChipmunkObjectFlatten() method created. Originally I had created it that way for what turned out to be imaginary performance reasons. So I fixed it to be more flexible.