project_files/HedgewarsMobile/Classes/LevelViewController.m
branchios-revival
changeset 11206 2e80c9861818
parent 11148 064a53861759
child 11217 e68b3e392091
equal deleted inserted replaced
11205:9fd7b8d3cf4d 11206:2e80c9861818
    29 
    29 
    30 #pragma mark -
    30 #pragma mark -
    31 #pragma mark View lifecycle
    31 #pragma mark View lifecycle
    32 -(void) viewDidLoad {
    32 -(void) viewDidLoad {
    33     [super viewDidLoad];
    33     [super viewDidLoad];
    34     srandom(time(NULL));
       
    35 
    34 
    36     NSArray *array = [[NSArray alloc] initWithObjects:
    35     NSArray *array = [[NSArray alloc] initWithObjects:
    37                       NSLocalizedString(@"Brutal",@""),
    36                       NSLocalizedString(@"Brutal",@""),
    38                       NSLocalizedString(@"Aggressive",@""),
    37                       NSLocalizedString(@"Aggressive",@""),
    39                       NSLocalizedString(@"Bully",@""),
    38                       NSLocalizedString(@"Bully",@""),
   131     NSInteger level;
   130     NSInteger level;
   132 
   131 
   133     if (theSwitch.on) {
   132     if (theSwitch.on) {
   134         numberOfSections = 2;
   133         numberOfSections = 2;
   135         [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   134         [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
   136         level = 1 + (random() % ([levelArray count] - 1));
   135         level = 1 + arc4random_uniform((int)[levelArray count] - 1);
   137     } else {
   136     } else {
   138         numberOfSections = 1;
   137         numberOfSections = 1;
   139         [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   138         [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
   140         level = 0;
   139         level = 0;
   141     }
   140     }