--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Oct 08 21:17:24 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sat Oct 08 22:44:32 2011 +0200
@@ -42,46 +42,39 @@
// check if some configuration files are already set; if they are present it means that the current copy must be updated
-(void) createNecessaryFiles {
- NSString *resourcesDir = [[NSBundle mainBundle] resourcePath];
DLog(@"Creating necessary files");
+ NSInteger index;
// SAVES - just delete and overwrite
if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
[[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
- [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
+ [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY()
+ withIntermediateDirectories:NO
+ attributes:nil
+ error:NULL];
// SETTINGS - nsuserdefaults ftw
[CreationChamber createSettings];
// TEAMS - update exisiting teams with new format
- if ([[NSFileManager defaultManager] fileExistsAtPath:TEAMS_DIRECTORY()] == NO) {
- [[NSFileManager defaultManager] createDirectoryAtPath:TEAMS_DIRECTORY()
- withIntermediateDirectories:YES
- attributes:nil
- error:NULL];
- // we copy teams only the first time because it's unlikely that newer ones are going to be added
- NSString *baseTeamsDir = [[NSString alloc] initWithFormat:@"%@/Settings/Teams/",resourcesDir];
- for (NSString *str in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:baseTeamsDir error:NULL]) {
- NSString *sourceFile = [baseTeamsDir stringByAppendingString:str];
- NSString *destinationFile = [TEAMS_DIRECTORY() stringByAppendingString:str];
- [[NSFileManager defaultManager] removeItemAtPath:destinationFile error:NULL];
- [[NSFileManager defaultManager] copyItemAtPath:sourceFile toPath:destinationFile error:NULL];
- }
- [baseTeamsDir release];
- }
- // merge not needed as format rarely changes
+ NSArray *teamNames = [[NSArray alloc] initWithObjects:@"Edit Me!",@"Ninjas",@"Pirates",@"Robots",nil];
+ index = 0;
+ for (NSString *name in teamNames)
+ [CreationChamber createTeamNamed:name ofType:index++ controlledByAI:[name isEqualToString:@"Robots"]];
+ [teamNames release];
// SCHEMES - always overwrite and delete custom ones
if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES)
[[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL];
- NSArray *schemeNames = [[NSArray alloc] initWithObjects:@"Default",@"Pro Mode",@"Shoppa",@"Clean Slate",@"Minefield",
- @"Barrel Mayhem",@"Tunnel Hogs",@"Fort Mode",@"Timeless",@"Thinking with Portals",@"King Mode",nil];
- NSInteger index = 0;
+ NSArray *schemeNames = [[NSArray alloc] initWithObjects:@"Default",@"Pro Mode",@"Shoppa",@"Clean Slate",
+ @"Minefield",@"Barrel Mayhem",@"Tunnel Hogs",@"Fort Mode",@"Timeless",
+ @"Thinking with Portals",@"King Mode",nil];
+ index = 0;
for (NSString *name in schemeNames)
[CreationChamber createSchemeNamed:name ofType:index++];
[schemeNames release];
- // WEAPONS - always overwrite as merge is not needed (missing weaps the set are 0ed automatically)
+ // WEAPONS - always overwrite as merge is not needed (missing weaps are 0ed automatically)
NSArray *weaponNames = [[NSArray alloc] initWithObjects:@"Default",@"Crazy",@"Pro Mode",@"Shoppa",@"Clean Slate",
@"Minefield",@"Thinking with Portals",nil];
index = 0;