project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
branchios-revival
changeset 11148 064a53861759
parent 11147 f9c460720e02
child 11163 f65f462d5a06
equal deleted inserted replaced
11147:f9c460720e02 11148:064a53861759
   276     else if (index == 1)
   276     else if (index == 1)
   277         lastIndexPath = self.lastIndexPath_we;
   277         lastIndexPath = self.lastIndexPath_we;
   278     else
   278     else
   279         lastIndexPath = self.lastIndexPath_lu;
   279         lastIndexPath = self.lastIndexPath_lu;
   280 
   280 
   281     int newRow = [indexPath row];
   281     NSInteger newRow = [indexPath row];
   282     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
   282     NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
   283 
   283 
   284     if (newRow != oldRow) {
   284     if (newRow != oldRow) {
   285         //TODO: this code works only for a single section table
   285         //TODO: this code works only for a single section table
   286         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   286         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   287         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   287         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   297             // also set weaponset when selecting scheme, if set
   297             // also set weaponset when selecting scheme, if set
   298             NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
   298             NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
   299             if ([[settings objectForKey:@"sync_ws"] boolValue]) {
   299             if ([[settings objectForKey:@"sync_ws"] boolValue]) {
   300                 for (NSString *str in self.listOfWeapons) {
   300                 for (NSString *str in self.listOfWeapons) {
   301                     if ([str isEqualToString:self.selectedScheme]) {
   301                     if ([str isEqualToString:self.selectedScheme]) {
   302                         int row = [self.listOfSchemes indexOfObject:str];
   302                         NSInteger row = [self.listOfSchemes indexOfObject:str];
   303                         self.selectedWeapon = str;
   303                         self.selectedWeapon = str;
   304                         self.lastIndexPath_we = [NSIndexPath indexPathForRow:row inSection:1];
   304                         self.lastIndexPath_we = [NSIndexPath indexPathForRow:row inSection:1];
   305                         break;
   305                         break;
   306                     }
   306                     }
   307                 }
   307                 }