project_files/HedgewarsMobile/Classes/VoicesViewController.m
changeset 3662 a44406f4369b
parent 3547 02875b1145b7
child 3667 9359a70df013
equal deleted inserted replaced
3661:2378ada8a6ee 3662:a44406f4369b
    20 }
    20 }
    21 
    21 
    22 
    22 
    23 #pragma mark -
    23 #pragma mark -
    24 #pragma mark View lifecycle
    24 #pragma mark View lifecycle
    25 - (void)viewDidLoad {
    25 -(void) viewDidLoad {
    26     [super viewDidLoad];
    26     [super viewDidLoad];
    27     srandom(time(NULL));
    27     srandom(time(NULL));
    28 
    28 
    29     openal_init();
    29     openal_init();
    30     voiceBeingPlayed = -1;
    30     voiceBeingPlayed = -1;
    31 
    31 
    32     // load all the voices names and store them into voiceArray
    32     // load all the voices names and store them into voiceArray
    33     // it's here and not in viewWillAppear because user cannot add/remove them
    33     // it's here and not in viewWillAppear because user cannot add/remove them
    34     NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
    34     NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
    35     self.voiceArray = array;
    35     self.voiceArray = array;
       
    36     
       
    37     self.title = NSLocalizedString(@"Set hedgehog voices",@"");
    36 }
    38 }
    37 
    39 
    38 - (void)viewWillAppear:(BOOL)animated {
    40 -(void) viewWillAppear:(BOOL)animated {
    39     [super viewWillAppear:animated];
    41     [super viewWillAppear:animated];
    40     
    42     
    41     // this moves the tableview to the top
    43     // this moves the tableview to the top
    42     [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
    44     [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
    43 }
    45 }
   132     openal_close();
   134     openal_close();
   133     voiceBeingPlayed = -1;
   135     voiceBeingPlayed = -1;
   134     self.lastIndexPath = nil;
   136     self.lastIndexPath = nil;
   135     self.teamDictionary = nil;
   137     self.teamDictionary = nil;
   136     self.voiceArray = nil;
   138     self.voiceArray = nil;
       
   139     MSG_DIDUNLOAD();
   137     [super viewDidUnload];
   140     [super viewDidUnload];
   138     MSG_DIDUNLOAD();
       
   139 }
   141 }
   140 
   142 
   141 -(void) dealloc {
   143 -(void) dealloc {
   142     [voiceArray release];
   144     [voiceArray release];
   143     [teamDictionary release];
   145     [teamDictionary release];