project_files/HedgewarsMobile/Classes/CreationChamber.m
changeset 5185 7607a64e1853
parent 5181 102fef5ca5fc
child 5200 7440fe992e73
equal deleted inserted replaced
5184:bf7bba60ed93 5185:7607a64e1853
   181     [theWeapon release];
   181     [theWeapon release];
   182 }
   182 }
   183 
   183 
   184 void createSchemeNamed (NSString *nameWithoutExt) {
   184 void createSchemeNamed (NSString *nameWithoutExt) {
   185     NSString *schemesDirectory = SCHEMES_DIRECTORY();
   185     NSString *schemesDirectory = SCHEMES_DIRECTORY();
   186     NSString *path = nil;
       
   187 
   186 
   188     if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
   187     if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
   189         [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
   188         [[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
   190                                   withIntermediateDirectories:NO
   189                                   withIntermediateDirectories:NO
   191                                                    attributes:nil
   190                                                    attributes:nil
   192                                                         error:NULL];
   191                                                         error:NULL];
   193     }
   192     }
   194 
   193 
   195     // load data to get the size of the arrays and their default values
   194     // load data to get the size of the arrays and their default values
   196     path = [NSString stringWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()];
   195     NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:BASICFLAGS_FILE()];
   197     NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:path];
       
   198     NSMutableArray *basicArray  = [[NSMutableArray alloc] initWithCapacity:[basicSettings count]];
   196     NSMutableArray *basicArray  = [[NSMutableArray alloc] initWithCapacity:[basicSettings count]];
   199     for (NSDictionary *basicDict in basicSettings)
   197     for (NSDictionary *basicDict in basicSettings)
   200         [basicArray addObject:[basicDict objectForKey:@"default"]];
   198         [basicArray addObject:[basicDict objectForKey:@"default"]];
   201     [basicSettings release];
   199     [basicSettings release];
   202 
   200 
   203     path = [NSString stringWithFormat:@"%@/gameFlags_en.plist",IFRONTEND_DIRECTORY()];
   201     NSArray *mods = [[NSArray alloc] initWithContentsOfFile:GAMEMODS_FILE()];
   204     NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
       
   205     NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]];
   202     NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]];
   206     for (int i = 0; i < [mods count]; i++)
   203     for (int i = 0; i < [mods count]; i++)
   207         [gamemodArray addObject:[NSNumber numberWithBool:NO]];
   204         [gamemodArray addObject:[NSNumber numberWithBool:NO]];
   208     [mods release];
   205     [mods release];
   209 
   206