@implementation Level
@synthesize doors, rooms;
- (id) init
{
self = [super init];
if (self != nil) {
rooms = [[NSMutableArray alloc] init];
doors = [[NSMutableArray alloc] init];
}
return self;
}
- (void)generate{
int room_count = 2;
Room *room;
for (int i=0; i<room_count; i++) {
room = [[Room alloc] init];
[room generate_Doors];
[self.rooms addObject:room];
[room release];
}
for (int i=0; i<[rooms count]; i++) {
Room *r=[rooms objectAtIndex:i];
//After this point rooms is invalid
int l=[[r doors] count];
for (int j=0; j<l; j++) {
Door *d=[[[rooms objectAtIndex:i] doors] objectAtIndex:j];
[self.doors addObject:d];
}
}
}
This is that i've seen in debugger