yes - you're right i could do that.
I had it this way because this function was copied from another that removed several objects. like this.
Code:
NSMutableArray *discardedItems_1 = [[NSMutableArray alloc] initWithCapacity:0];
for (cell in set)
{
//NSLog(@"updateDiag: testing for adjacent
// above
c=[self getBoardCell:CGPointMake(cell.center.x,cell.center.y+kBlokusGridSize)];
if (c && c->color==shape.shapeInfo.color) [discardedItems_1 addObject:cell];
// below
c=[self getBoardCell:CGPointMake(cell.center.x,cell.center.y-kBlokusGridSize)];
if (c && c->color==shape.shapeInfo.color) [discardedItems_1 addObject:cell];
// left
c=[self getBoardCell:CGPointMake(cell.center.x-kBlokusGridSize,cell.center.y)];
if (c && c->color==shape.shapeInfo.color) [discardedItems_1 addObject:cell];
// right
c=[self getBoardCell:CGPointMake(cell.center.x+kBlokusGridSize,cell.center.y)];
if (c && c->color==shape.shapeInfo.color) [discardedItems_1 addObject:cell];
}
for (cell in discardedItems_1)
{
//NSLog(@"removing diag due to adjacent [%d,%d]", cell.x, cell.y);
[set removeObject:cell];
}
[discardedItems_1 release];
Now I'm worried the above method (and other I have like it) will not work much in the same way the original didnt. I really appreciate the suggestion and I've made the change because it's more efficient.
But, unfortuneately, it doesnt explain the problem i was having.