project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 6103 55ecfbf834e3
parent 6094 16b12a6417d1
child 6104 117bdf4e7af9
equal deleted inserted replaced
6102:97565ab4afe9 6103:55ecfbf834e3
    49     if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
    49     if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
    50         [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
    50         [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
    51     [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
    51     [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
    52     
    52     
    53     // SETTINGS - nsuserdefaults ftw
    53     // SETTINGS - nsuserdefaults ftw
    54     createSettings();
    54     [CreationChamber createSettings];
    55 
    55 
    56     // TEAMS - update exisiting teams with new format
    56     // TEAMS - update exisiting teams with new format
    57     if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()] == NO) {
    57     if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()] == NO) {
    58         [[NSFileManager defaultManager] createDirectoryAtPath:TEAMS_DIRECTORY()
    58         [[NSFileManager defaultManager] createDirectoryAtPath:TEAMS_DIRECTORY()
    59                                   withIntermediateDirectories:YES
    59                                   withIntermediateDirectories:YES
    72     // merge not needed as format rarely changes
    72     // merge not needed as format rarely changes
    73 
    73 
    74     // SCHEMES - always overwrite and delete custom ones
    74     // SCHEMES - always overwrite and delete custom ones
    75     if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES)
    75     if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES)
    76         [[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL];
    76         [[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL];
    77     createSchemeNamed(@"Default", 0);
    77     NSArray *schemeNames = [[NSArray alloc] initWithObjects:@"Default",@"Pro Mode",@"Shoppa",@"Clean Slate",@"Minefield",
    78     createSchemeNamed(@"Pro Mode", 1);
    78                             @"Barrel Mayhem",@"Tunnel Hogs",@"Fort Mode",@"Timeless",@"Thinking with Portals",@"King Mode",nil];
    79     createSchemeNamed(@"Shoppa", 2);
    79     NSInteger index = 0;
    80     createSchemeNamed(@"Clean Slate", 3);
    80     for (NSString *name in schemeNames)
    81     createSchemeNamed(@"Minefield", 4);
    81         [CreationChamber createSchemeNamed:name ofType:index++];
    82     createSchemeNamed(@"Barrel Mayhem", 5);
    82     [schemeNames release];
    83     createSchemeNamed(@"Tunnel Hogs", 6);
    83 
    84     createSchemeNamed(@"Fort Mode", 7);
    84     // WEAPONS - always overwrite as merge is not needed (missing weaps the set are 0ed automatically)
    85     createSchemeNamed(@"Timeless", 8);
    85     NSArray *weaponNames = [[NSArray alloc] initWithObjects:@"Default",@"Crazy",@"Pro Mode",@"Shoppa",@"Clean Slate",
    86     createSchemeNamed(@"Thinking with Portals", 9);
    86                             @"Minefield",@"Thinking with Portals",nil];
    87     createSchemeNamed(@"King Mode", 10);
    87     index = 0;
    88 
    88     for (NSString *name in weaponNames)
    89     // WEAPONS - always overwrite
    89         [CreationChamber createWeaponNamed:name ofType:index++];
    90     createWeaponNamed(@"Default", 0);
    90     [weaponNames release];
    91     createWeaponNamed(@"Crazy", 1);
       
    92     createWeaponNamed(@"Pro Mode", 2);
       
    93     createWeaponNamed(@"Shoppa", 3);
       
    94     createWeaponNamed(@"Clean Slate", 4);
       
    95     createWeaponNamed(@"Minefield", 5);
       
    96     createWeaponNamed(@"Thinking with Portals", 6);
       
    97     // merge not needed because weapons not present in the set are 0ed by GameSetup
       
    98 }
    91 }
    99 
    92 
   100 #pragma mark -
    93 #pragma mark -
   101 -(void) viewDidLoad {
    94 -(void) viewDidLoad {
   102     [super viewDidLoad];
    95     [super viewDidLoad];