project_files/HedgewarsMobile/Classes/LevelViewController.m
branchios-revival
changeset 11148 064a53861759
parent 10108 c68cf030eded
child 11206 2e80c9861818
equal deleted inserted replaced
11147:f9c460720e02 11148:064a53861759
   139         [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   139         [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   140         level = 0;
   140         level = 0;
   141     }
   141     }
   142     [sections release];
   142     [sections release];
   143 
   143 
   144     DLog(@"New level is %d",level);
   144     DLog(@"New level is %ld", (long)level);
   145     for (NSMutableDictionary *hog in hogs)
   145     for (NSMutableDictionary *hog in hogs)
   146         [hog setObject:[NSNumber numberWithInt:level] forKey:@"level"];
   146         [hog setObject:[NSNumber numberWithInteger:level] forKey:@"level"];
   147 
   147 
   148     [self.tableView reloadData];
   148     [self.tableView reloadData];
   149     [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
   149     [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
   150 }
   150 }
   151 
   151 
   152 
   152 
   153 #pragma mark -
   153 #pragma mark -
   154 #pragma mark Table view delegate
   154 #pragma mark Table view delegate
   155 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   155 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   156     int newRow = [indexPath row];
   156     NSInteger newRow = [indexPath row];
   157     int oldRow = (self.lastIndexPath != nil) ? [self.lastIndexPath row] : -1;
   157     NSInteger oldRow = (self.lastIndexPath != nil) ? [self.lastIndexPath row] : -1;
   158 
   158 
   159     if ([indexPath section] != 0) {
   159     if ([indexPath section] != 0) {
   160         if (newRow != oldRow) {
   160         if (newRow != oldRow) {
   161             NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
   161             NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
   162 
   162 
   163             NSInteger level = newRow + 1;
   163             NSInteger level = newRow + 1;
   164             for (NSMutableDictionary *hog in hogs)
   164             for (NSMutableDictionary *hog in hogs)
   165                 [hog setObject:[NSNumber numberWithInt:level] forKey:@"level"];
   165                 [hog setObject:[NSNumber numberWithInteger:level] forKey:@"level"];
   166             DLog(@"New level is %d",level);
   166             DLog(@"New level is %ld", (long)level);
   167 
   167 
   168             // tell our boss to write this new stuff on disk
   168             // tell our boss to write this new stuff on disk
   169             [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
   169             [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
   170             [self.tableView reloadData];
   170             [self.tableView reloadData];
   171 
   171