equal
deleted
inserted
replaced
135 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
135 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
136 return 2; |
136 return 2; |
137 } |
137 } |
138 |
138 |
139 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
139 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
140 if (section == 0) |
140 return (section == 0 ? selectedTeamsCount : allTeamsCount); |
141 return selectedTeamsCount; |
|
142 else |
|
143 return allTeamsCount; |
|
144 } |
141 } |
145 |
142 |
146 // Customize the appearance of table view cells. |
143 // Customize the appearance of table view cells. |
147 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
144 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
148 static NSString *CellIdentifier0 = @"Cell0"; |
145 static NSString *CellIdentifier0 = @"Cell0"; |
175 } else { |
172 } else { |
176 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
173 cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1]; |
177 if (cell == nil) |
174 if (cell == nil) |
178 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; |
175 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease]; |
179 |
176 |
180 cell.textLabel.text = [[[listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; |
177 cell.textLabel.text = [[[self.listOfTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension]; |
181 cell.textLabel.backgroundColor = [UIColor clearColor]; |
178 cell.textLabel.backgroundColor = [UIColor clearColor]; |
182 |
179 |
183 NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text]; |
180 NSString *teamPath = [NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),cell.textLabel.text]; |
184 NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0]; |
181 NSDictionary *firstHog = [[[NSDictionary dictionaryWithContentsOfFile:teamPath] objectForKey:@"hedgehogs"] objectAtIndex:0]; |
185 if ([[firstHog objectForKey:@"level"] intValue] != 0) { |
182 if ([[firstHog objectForKey:@"level"] intValue] != 0) { |
297 } |
294 } |
298 |
295 |
299 #pragma mark - |
296 #pragma mark - |
300 #pragma mark Memory management |
297 #pragma mark Memory management |
301 -(void) didReceiveMemoryWarning { |
298 -(void) didReceiveMemoryWarning { |
302 // Relinquish ownership any cached data, images, etc that aren't in use. |
299 if ([[HedgewarsAppDelegate sharedAppDelegate] isInGame]) { |
|
300 self.listOfSelectedTeams = nil; |
|
301 self.listOfTeams = nil; |
|
302 } |
303 self.cachedContentsOfDir = nil; |
303 self.cachedContentsOfDir = nil; |
304 MSG_MEMCLEAN(); |
304 MSG_MEMCLEAN(); |
305 [super didReceiveMemoryWarning]; |
305 [super didReceiveMemoryWarning]; |
306 } |
306 } |
307 |
307 |