Hi,
This is a 2 part question for a match 3 game I'm making.
part 1:
I want to run another method to remove the nodes not flagged connected after the following method flags nodes connected. The recursion does end, it's not stuck in an infinite loop.
If I add a breakpoint after calling the flagConnectedWithIndex method (or NSLog), it is never reached.
part 2:
How can I free the memory allocated for the surroundingIndices pointer?
Thanks a lot!
This is a 2 part question for a match 3 game I'm making.
part 1:
I want to run another method to remove the nodes not flagged connected after the following method flags nodes connected. The recursion does end, it's not stuck in an infinite loop.
If I add a breakpoint after calling the flagConnectedWithIndex method (or NSLog), it is never reached.
part 2:
How can I free the memory allocated for the surroundingIndices pointer?
Code:
-(void) flagConnectedWithIndex:(int)index
{
NSMutableArray *surroundingIndices = [self getSurroundingIndices:index];
for(NSNumber *num in surroundingIndices) {
int indexNum = [num intValue];
id obj = [arrayEnemyTargets_ objectAtIndex:indexNum];
if(obj != [NSNull null]) {
Enemytarget *t = obj;
if(!t.isDead && !t.connected) {
t.connected = YES;
//[t setOpacity:128];
[self flagConnectedWithIndex:t.index];
}
}
}
}
Thanks a lot!