102 for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams) |
101 for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams) |
103 hogs += [[teamData objectForKey:@"number"] intValue]; |
102 hogs += [[teamData objectForKey:@"number"] intValue]; |
104 |
103 |
105 if (hogs > mapConfigViewController.maxHogs) { |
104 if (hogs > mapConfigViewController.maxHogs) { |
106 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"") |
105 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"") |
107 message:NSLocalizedString(@"The map you selected is too small for that many hogs",@"") |
106 message:NSLocalizedString(@"The map is too small for that many hogs",@"") |
108 delegate:nil |
107 delegate:nil |
109 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
108 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
110 otherButtonTitles:nil]; |
109 otherButtonTitles:nil]; |
111 [alert show]; |
110 [alert show]; |
112 [alert release]; |
111 [alert release]; |
113 return; |
112 return; |
114 } |
113 } |
115 |
114 |
116 if ([schemeWeaponConfigViewController.selectedScheme length] == 0 || [schemeWeaponConfigViewController.selectedWeapon length] == 0 ) { |
115 if ([schemeWeaponConfigViewController.selectedScheme length] == 0 || [schemeWeaponConfigViewController.selectedWeapon length] == 0 ) { |
117 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Missing detail",@"") |
116 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Missing detail",@"") |
118 message:NSLocalizedString(@"Make sure you selected one Scheme and one Weapon for this game",@"") |
117 message:NSLocalizedString(@"Select one Scheme and one Weapon for this game",@"") |
119 delegate:nil |
118 delegate:nil |
120 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
119 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
121 otherButtonTitles:nil]; |
120 otherButtonTitles:nil]; |
122 [alert show]; |
121 [alert show]; |
123 [alert release]; |
122 [alert release]; |
124 return; |
123 return; |
125 } |
124 } |
126 |
125 |
127 // create the configuration file that is going to be sent to engine |
126 // create the configuration file that is going to be sent to engine |
128 NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command", |
127 NSDictionary *gameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command", |
129 mapConfigViewController.templateFilterCommand,@"templatefilter_command", |
128 mapConfigViewController.templateFilterCommand,@"templatefilter_command", |
130 mapConfigViewController.mapGenCommand,@"mapgen_command", |
129 mapConfigViewController.mapGenCommand,@"mapgen_command", |
131 mapConfigViewController.mazeSizeCommand,@"mazesize_command", |
130 mapConfigViewController.mazeSizeCommand,@"mazesize_command", |
132 mapConfigViewController.themeCommand,@"theme_command", |
131 mapConfigViewController.themeCommand,@"theme_command", |
133 teamConfigViewController.listOfSelectedTeams,@"teams_list", |
132 teamConfigViewController.listOfSelectedTeams,@"teams_list", |
134 schemeWeaponConfigViewController.selectedScheme,@"scheme", |
133 schemeWeaponConfigViewController.selectedScheme,@"scheme", |
135 schemeWeaponConfigViewController.selectedWeapon,@"weapon", |
134 schemeWeaponConfigViewController.selectedWeapon,@"weapon", |
136 nil]; |
135 nil]; |
137 [dict writeToFile:GAMECONFIG_FILE() atomically:YES]; |
|
138 [dict release]; |
|
139 |
136 |
140 // finally launch game and remove this controller |
137 // finally launch game and remove this controller |
141 [[self parentViewController] dismissModalViewControllerAnimated:YES]; |
138 [[self parentViewController] dismissModalViewControllerAnimated:YES]; |
142 [[SDLUIKitDelegate sharedAppDelegate] startSDLgame]; |
139 [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary]; |
|
140 [gameDictionary release]; |
143 } |
141 } |
144 |
142 |
145 -(void) viewDidLoad { |
143 -(void) viewDidLoad { |
146 CGRect screen = [[UIScreen mainScreen] bounds]; |
144 CGRect screen = [[UIScreen mainScreen] bounds]; |
147 self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); |
145 self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width); |