--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m Tue Sep 08 19:20:58 2015 +0300
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m Mon Nov 16 22:57:24 2015 +0300
@@ -32,7 +32,6 @@
#pragma mark View lifecycle
-(void) viewDidLoad {
[super viewDidLoad];
- srandom(time(NULL));
voiceBeingPlayed = NULL;
@@ -104,8 +103,8 @@
#pragma mark -
#pragma mark Table view delegate
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- int newRow = [indexPath row];
- int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
+ NSInteger newRow = [indexPath row];
+ NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
if (newRow != oldRow) {
[teamDictionary setObject:[voiceArray objectAtIndex:newRow] forKey:@"voicepack"];
@@ -129,7 +128,7 @@
NSString *voiceDir = [[NSString alloc] initWithFormat:@"%@/%@/",VOICES_DIRECTORY(),[voiceArray objectAtIndex:newRow]];
NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:voiceDir error:NULL];
- int index = random() % [array count];
+ int index = arc4random_uniform((int)[array count]);
voiceBeingPlayed = Mix_LoadWAV([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]);
[voiceDir release];