project_files/HedgewarsMobile/Classes/MapConfigViewController.m
changeset 4356 d1d26f8963a3
parent 4349 8efa91f98274
child 4362 8dae325dc625
equal deleted inserted replaced
4354:c4e1820fa792 4356:d1d26f8963a3
   387     [themeArray removeLastObject];
   387     [themeArray removeLastObject];
   388     NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
   388     NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
   389     NSMutableArray *mapArray = [[NSMutableArray alloc] init];
   389     NSMutableArray *mapArray = [[NSMutableArray alloc] init];
   390     for (NSString *str in mapArrayFull) {
   390     for (NSString *str in mapArrayFull) {
   391         CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
   391         CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
   392         //DLog(@"%@ %f %f", str, imgSize.width, imgSize.height);
   392         // remove images that are too big for certain devices
   393         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
   393         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
   394             continue;
   394             continue;
   395         if (IS_IPAD() && imgSize.height > 1280.0f)
   395         if ([modelType() hasPrefix:@"iPad1"] && [[[UIDevice currentDevice] systemVersion] intValue] < 4 && imgSize.height > 1280.0f)
   396             continue;
   396             continue;
   397         [mapArray addObject:str];
   397         [mapArray addObject:str];
   398     }
   398     }
   399     
   399     
   400     NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
   400     NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
   401     NSMutableArray *missionArray = [[NSMutableArray alloc] init];
   401     NSMutableArray *missionArray = [[NSMutableArray alloc] init];
   402     for (NSString *str in missionArrayFull) {
   402     for (NSString *str in missionArrayFull) {
   403         CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
   403         CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
   404         //DLog(@"%@ %f %f", str, imgSize.width, imgSize.height);
   404         // remove images that are too big for certain devices
   405         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
   405         if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
   406             continue;
   406             continue;
   407         if (IS_IPAD() && imgSize.height > 1280.0f)
   407         if ([modelType() hasPrefix:@"iPad1"] && [[[UIDevice currentDevice] systemVersion] intValue] < 4 && imgSize.height > 1280.0f)
   408             continue;
   408             continue;
   409         [missionArray addObject:str];
   409         [missionArray addObject:str];
   410     }
   410     }
   411     NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
   411     NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
   412     [missionArray release];
   412     [missionArray release];
   447     self.staticMapCommand = @"";
   447     self.staticMapCommand = @"";
   448     self.missionCommand = @"";
   448     self.missionCommand = @"";
   449 
   449 
   450     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)])
   450     if ([self.tableView respondsToSelector:@selector(setBackgroundView:)])
   451         [self.tableView setBackgroundView:nil];
   451         [self.tableView setBackgroundView:nil];
   452     self.view.backgroundColor = [UIColor clearColor];
   452     self.tableView.backgroundColor = [UIColor clearColor];
   453     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
   453     self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
   454     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   454     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   455 }
   455 }
   456 
   456 
   457 -(void) viewWillAppear:(BOOL)animated {
   457 -(void) viewWillAppear:(BOOL)animated {
   489     [super viewDidUnload];
   489     [super viewDidUnload];
   490 }
   490 }
   491 
   491 
   492 -(void) didReceiveMemoryWarning {
   492 -(void) didReceiveMemoryWarning {
   493     self.dataSourceArray = nil;
   493     self.dataSourceArray = nil;
   494 
   494     [super didReceiveMemoryWarning];
   495     self.tableView = nil;
   495 
   496     self.maxLabel = nil;
   496     if (self.view.superview == nil) {
   497     self.sizeLabel = nil;
   497         self.tableView = nil;
   498     self.slider = nil;
   498         self.maxLabel = nil;
       
   499         self.sizeLabel = nil;
       
   500         self.slider = nil;
       
   501     }
   499 
   502 
   500     MSG_MEMCLEAN();
   503     MSG_MEMCLEAN();
   501     [super didReceiveMemoryWarning];
       
   502 }
   504 }
   503 
   505 
   504 -(void) dealloc {
   506 -(void) dealloc {
   505     [seedCommand release];
   507     [seedCommand release];
   506     [templateFilterCommand release];
   508     [templateFilterCommand release];