equal
deleted
inserted
replaced
21 |
21 |
22 #import "FortsViewController.h" |
22 #import "FortsViewController.h" |
23 #import "CommodityFunctions.h" |
23 #import "CommodityFunctions.h" |
24 #import "UIImageExtra.h" |
24 #import "UIImageExtra.h" |
25 |
25 |
26 #define IMGNUM_PER_FORT 4 |
26 #define IMGNUM_PER_FORT 6 |
27 |
27 |
28 @implementation FortsViewController |
28 @implementation FortsViewController |
29 @synthesize teamDictionary, fortArray, lastIndexPath; |
29 @synthesize teamDictionary, fortArray, lastIndexPath; |
30 |
30 |
31 |
31 |
38 #pragma mark View lifecycle |
38 #pragma mark View lifecycle |
39 -(void) viewDidLoad { |
39 -(void) viewDidLoad { |
40 [super viewDidLoad]; |
40 [super viewDidLoad]; |
41 |
41 |
42 NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FORTS_DIRECTORY() error:NULL]; |
42 NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FORTS_DIRECTORY() error:NULL]; |
43 NSMutableArray *filteredContents = [[NSMutableArray alloc] initWithCapacity:([directoryContents count] / 3)]; |
43 NSMutableArray *filteredContents = [[NSMutableArray alloc] initWithCapacity:([directoryContents count] / IMGNUM_PER_FORT)]; |
44 // we need to remove the double entries and the L.png suffix |
44 // we need to remove the double entries and the L.png suffix |
45 for (int i = 0; i < [directoryContents count]; i++) { |
45 for (int i = 0; i < [directoryContents count]; i++) { |
46 if (i % IMGNUM_PER_FORT == 3) { |
46 if (i % IMGNUM_PER_FORT == IMGNUM_PER_FORT-1) { |
47 NSString *currentName = [directoryContents objectAtIndex:i]; |
47 NSString *currentName = [directoryContents objectAtIndex:i]; |
48 NSString *correctName = [currentName substringToIndex:([currentName length] - 5)]; |
48 NSString *correctName = [currentName substringToIndex:([currentName length] - 5)]; |
49 [filteredContents addObject:correctName]; |
49 [filteredContents addObject:correctName]; |
50 } |
50 } |
51 } |
51 } |