1.  
  2. - (void) loadRangeData {
  3. NSBundle *bundle = [NSBundle mainBundle];
  4. NSString *textFilePath = [bundle pathForResource:@"pfhr" ofType:@"txt"];
  5. NSString *fileContents = [NSString stringWithContentsOfFile:textFilePath];
  6.  
  7. NSArray *quizArray = [[NSArray alloc] initWithArray:[fileContents componentsSeparatedByString:@"\n"]];
  8. NSString *temp;
  9. NSArray *atemp;
  10. NSString *offset;
  11. handSliderValues = (float*) malloc(sizeof(float) * [quizArray count]);
  12. handSliderCells = (int*) malloc(sizeof(float) * [quizArray count]);
  13. for (int i = 0; i < [quizArray count]; i++) {
  14. temp = (NSString*) [quizArray objectAtIndex:i];
  15. atemp = [temp componentsSeparatedByString:@","];
  16. float perc = [[atemp objectAtIndex:1] floatValue];
  17. offset = [atemp objectAtIndex:0];
  18.  
  19. int x = 0;
  20. int y = 0;
  21. if ([offset length] == 3) {
  22. // offsuit
  23. if ([offset characterAtIndex:2] == 'o') {
  24. x = [Card getRankInt:[offset characterAtIndex:0]];
  25. y = [Card getRankInt:[offset characterAtIndex:1]];
  26.  
  27. } else {
  28. y = [Card getRankInt:[offset characterAtIndex:0]];
  29. x = [Card getRankInt:[offset characterAtIndex:1]];
  30. }
  31. } else {
  32. // pair
  33. x = [Card getRankInt:[offset characterAtIndex:0]];
  34. y = x;
  35. }
  36. int ofs = (12-y) * 13 + (12-x);
  37. handSliderCells[i] = ofs;
  38. handSliderValues[i] = perc;
  39.  
  40. }
  41.  
  42. // [bundle release];
  43. // [textFilePath release];
  44. // [fileContents release];
  45. // [quizArray release];
  46. [temp release];
  47. [atemp release];
  48. // [offset release];
  49. }
  50.