# HG changeset patch # User koda # Date 1316646177 -7200 # Node ID 6fd40d866342495ac49141e0d3438274ccf0dd3e # Parent f0925204f50eeff75a69375488d3e092f09a403e create the ios schemes programmatically diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Classes/CreationChamber.h --- a/project_files/HedgewarsMobile/Classes/CreationChamber.h Wed Sep 21 23:15:44 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.h Thu Sep 22 01:02:57 2011 +0200 @@ -24,4 +24,4 @@ void createSettings (void); void createTeamNamed (NSString *nameWithoutExt); void createWeaponNamed (NSString *nameWithoutExt, int type); -void createSchemeNamed (NSString *nameWithoutExt); +void createSchemeNamed (NSString *nameWithoutExt, int type); diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Classes/CreationChamber.m --- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Wed Sep 21 23:15:44 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Thu Sep 22 01:02:57 2011 +0200 @@ -150,7 +150,7 @@ [theWeapon release]; } -void createSchemeNamed (NSString *nameWithoutExt) { +void createSchemeNamed (NSString *nameWithoutExt, int type) { NSString *schemesDirectory = SCHEMES_DIRECTORY(); if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) { @@ -173,8 +173,106 @@ [gamemodArray addObject:[NSNumber numberWithBool:NO]]; [mods release]; - // workaround for randomorder that has to be set to YES - [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + switch (type) { + case 0: // default + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + break; + case 1: // pro mode + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:15]]; + [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; + break; + case 2: // shoppa + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; + [basicArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:50]]; + [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:1]]; + [basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:25]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; + [gamemodArray replaceObjectAtIndex:1 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; + break; + case 3: // clean slate + [gamemodArray replaceObjectAtIndex:6 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:18 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:19 withObject:[NSNumber numberWithBool:YES]]; + break; + case 4: // minefield + [basicArray replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:50]]; + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; + [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:80]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; + break; + case 5: // barrel mayhem + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; + [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:40]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; + break; + case 6: // tunnel hogs + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:30]]; + [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:3]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:10]]; + [basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:10]]; + [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:14 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:15 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:16 withObject:[NSNumber numberWithBool:YES]]; + break; + case 7: // fort mode + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:0]]; + [gamemodArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:3 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + break; + case 8: // timeless + [basicArray replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:100]]; + [basicArray replaceObjectAtIndex:4 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:5 withObject:[NSNumber numberWithInt:0]]; + [basicArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithInt:30]]; + [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:5]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:3]]; + [basicArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithInt:10]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:20 withObject:[NSNumber numberWithBool:YES]]; + break; + case 9: // thinking with portals + [basicArray replaceObjectAtIndex:7 withObject:[NSNumber numberWithInt:2]]; + [basicArray replaceObjectAtIndex:8 withObject:[NSNumber numberWithInt:25]]; + [basicArray replaceObjectAtIndex:10 withObject:[NSNumber numberWithInt:4]]; + [basicArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithInt:5]]; + [basicArray replaceObjectAtIndex:13 withObject:[NSNumber numberWithInt:5]]; + [gamemodArray replaceObjectAtIndex:9 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + break; + case 10:// king mode + [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]]; + [gamemodArray replaceObjectAtIndex:12 withObject:[NSNumber numberWithBool:YES]]; + break; + default: + DLog(@"Impossible"); + break; + } NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys: basicArray,@"basic", @@ -182,7 +280,7 @@ nil]; [gamemodArray release]; [basicArray release]; - + NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt]; [theScheme writeToFile:schemeFile atomically:YES]; diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Wed Sep 21 23:15:44 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Thu Sep 22 01:02:57 2011 +0200 @@ -71,16 +71,19 @@ // SCHEMES - always overwrite and delete custom ones if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES) [[NSFileManager defaultManager] removeItemAtPath:SCHEMES_DIRECTORY() error:NULL]; - NSString *baseSchemesDir = [[NSString alloc] initWithFormat:@"%@/Settings/Schemes/",resourcesDir]; - [[NSFileManager defaultManager] copyItemAtPath:baseSchemesDir toPath:SCHEMES_DIRECTORY() error:NULL]; - [baseSchemesDir release]; + createSchemeNamed(@"Default", 0); + createSchemeNamed(@"Pro Mode", 1); + createSchemeNamed(@"Shoppa", 2); + createSchemeNamed(@"Clean Slate", 3); + createSchemeNamed(@"Minefield", 4); + createSchemeNamed(@"Barrel Mayhem", 5); + createSchemeNamed(@"Tunnel Hogs", 6); + createSchemeNamed(@"Fort Mode", 7); + createSchemeNamed(@"Timeless", 8); + createSchemeNamed(@"Thinking with Portals", 9); + createSchemeNamed(@"King Mode", 10); // WEAPONS - always overwrite - if ([[NSFileManager defaultManager] fileExistsAtPath:WEAPONS_DIRECTORY()] == NO) - [[NSFileManager defaultManager] createDirectoryAtPath:WEAPONS_DIRECTORY() - withIntermediateDirectories:YES - attributes:nil - error:NULL]; createWeaponNamed(@"Default", 0); createWeaponNamed(@"Crazy", 1); createWeaponNamed(@"Pro Mode", 2); diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m --- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Wed Sep 21 23:15:44 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Thu Sep 22 01:02:57 2011 +0200 @@ -78,7 +78,7 @@ -(void) addScheme:(id) sender { NSString *fileName = [[NSString alloc] initWithFormat:@"Scheme %u.plist", [self.listOfSchemes count]]; - createSchemeNamed([fileName stringByDeletingPathExtension]); + createSchemeNamed([fileName stringByDeletingPathExtension], 0); [self.listOfSchemes addObject:fileName]; diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 30 - 15 - 47 - 5 - 100 - 0 - 35 - 25 - 0 - 0 - 0 - 40 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Clean Slate.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Clean Slate.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 45 - 15 - 47 - 5 - 100 - 5 - 35 - 25 - 3 - 4 - 0 - 2 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 45 - 15 - 47 - 5 - 100 - 5 - 35 - 25 - 3 - 4 - 0 - 2 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Fort Mode.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Fort Mode.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 45 - 15 - 47 - 5 - 100 - 5 - 35 - 25 - 3 - 0 - 0 - 0 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/King Mode.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/King Mode.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 45 - 15 - 47 - 5 - 100 - 5 - 35 - 25 - 3 - 4 - 0 - 2 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 50 - 150 - 30 - 15 - 47 - 5 - 100 - 0 - 35 - 25 - 0 - 80 - 0 - 0 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 15 - 15 - 47 - 5 - 100 - 0 - 35 - 25 - 3 - 0 - 0 - 2 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 300 - 50 - 47 - 5 - 100 - 1 - 0 - 35 - 3 - 0 - 0 - 0 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Thinking with Portals.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Thinking with Portals.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 45 - 15 - 47 - 5 - 100 - 2 - 25 - 25 - 4 - 5 - 0 - 5 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 100 - 100 - 47 - 5 - 100 - 5 - 35 - 30 - 5 - 3 - 10 - 2 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f0925204f50e -r 6fd40d866342 project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist --- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist Wed Sep 21 23:15:44 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ - - - - - basic - - 100 - 100 - 30 - 15 - 47 - 5 - 100 - 5 - 35 - 3 - 25 - 10 - 10 - 10 - - gamemod - - - - - - - - - - - - - - - - - - - - - - - - - - - -