project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
changeset 3978 9660600e43cb
parent 3971 5c82ee165ed5
child 3996 eb549fd864a5
equal deleted inserted replaced
3977:9df7b4812da9 3978:9660600e43cb
    39     [self.tableView reloadData];
    39     [self.tableView reloadData];
    40 }
    40 }
    41 
    41 
    42 -(void) viewDidLoad {
    42 -(void) viewDidLoad {
    43     self.tableView.backgroundView = nil;
    43     self.tableView.backgroundView = nil;
    44     [[NSNotificationCenter defaultCenter] addObserver:self
       
    45                                              selector:@selector(viewWillAppear:)
       
    46                                                  name:@"removedSave"
       
    47                                                object:nil];
       
    48     [super viewDidLoad];
    44     [super viewDidLoad];
    49 }
    45 }
    50 
    46 
    51 -(void) viewWillAppear:(BOOL)animated {
    47 -(void) viewWillAppear:(BOOL)animated {
       
    48     [self updateTable];
    52     [super viewWillAppear:animated];
    49     [super viewWillAppear:animated];
    53     [self updateTable];
       
    54 }
    50 }
    55 
    51 
    56 #pragma mark -
    52 #pragma mark -
    57 #pragma mark button functions
    53 #pragma mark button functions
    58 -(IBAction) buttonPressed:(id) sender {
    54 -(IBAction) buttonPressed:(id) sender {
   196     [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil];
   192     [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil];
   197     
   193     
   198     NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]];
   194     NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]];
   199     
   195     
   200     NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:
   196     NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:
   201                                       [NSDictionary dictionary],@"game_dictionary",
       
   202                                       filePath,@"savefile",
   197                                       filePath,@"savefile",
   203                                       [NSNumber numberWithBool:NO],@"netgame",
   198                                       [NSNumber numberWithBool:NO],@"netgame",
       
   199                                       [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.interfaceOrientation] forKey:@"orientation"],@"game_dictionary",
   204                                       nil];
   200                                       nil];
   205     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
   201     [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
       
   202     [self.parentViewController dismissModalViewControllerAnimated:NO];
   206 }
   203 }
   207 
   204 
   208 #pragma mark -
   205 #pragma mark -
   209 #pragma mark editableCellView delegate
   206 #pragma mark editableCellView delegate
   210 // rename old file if names differ
   207 // rename old file if names differ