27 #define scIndex self.segmentedControl.selectedSegmentIndex |
27 #define scIndex self.segmentedControl.selectedSegmentIndex |
28 #define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) |
28 #define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) |
29 |
29 |
30 @implementation MapConfigViewController |
30 @implementation MapConfigViewController |
31 @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, |
31 @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, |
32 missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, delegate; |
32 missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy; |
33 |
33 |
34 |
34 |
35 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
35 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
36 return rotationManager(interfaceOrientation); |
36 return rotationManager(interfaceOrientation); |
37 } |
37 } |
364 [self updatePreview]; |
364 [self updatePreview]; |
365 oldPage = newPage; |
365 oldPage = newPage; |
366 } |
366 } |
367 |
367 |
368 #pragma mark - |
368 #pragma mark - |
369 #pragma mark delegate functions for iPad |
369 #pragma mark calls the parent's function that checks the parameters and starts the game |
370 -(IBAction) buttonPressed:(id) sender { |
370 -(IBAction) buttonPressed:(id) sender { |
371 if (self.delegate != nil && [delegate respondsToSelector:@selector(buttonPressed:)]) |
371 [[NSNotificationCenter defaultCenter] postNotificationName:@"buttonPressed" object:nil userInfo:[NSDictionary dictionaryWithObject:sender forKey:@"sender"]]; |
372 [self.delegate buttonPressed:(UIButton *)sender]; |
|
373 } |
372 } |
374 |
373 |
375 -(void) loadDataSourceArray { |
374 -(void) loadDataSourceArray { |
376 // themes.cfg contains all the user-selectable themes |
375 // themes.cfg contains all the user-selectable themes |
377 NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] |
376 NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"] |
441 [self updatePreview]; |
440 [self updatePreview]; |
442 [super viewDidAppear:animated]; |
441 [super viewDidAppear:animated]; |
443 } |
442 } |
444 |
443 |
445 -(void) viewDidUnload { |
444 -(void) viewDidUnload { |
446 self.delegate = nil; |
|
447 |
|
448 self.previewButton = nil; |
445 self.previewButton = nil; |
449 self.seedCommand = nil; |
446 self.seedCommand = nil; |
450 self.templateFilterCommand = nil; |
447 self.templateFilterCommand = nil; |
451 self.mapGenCommand = nil; |
448 self.mapGenCommand = nil; |
452 self.mazeSizeCommand = nil; |
449 self.mazeSizeCommand = nil; |
475 // maybe we can save some more |
472 // maybe we can save some more |
476 MSG_MEMCLEAN(); |
473 MSG_MEMCLEAN(); |
477 } |
474 } |
478 |
475 |
479 -(void) dealloc { |
476 -(void) dealloc { |
480 self.delegate = nil; |
|
481 |
|
482 [seedCommand release]; |
477 [seedCommand release]; |
483 [templateFilterCommand release]; |
478 [templateFilterCommand release]; |
484 [mapGenCommand release]; |
479 [mapGenCommand release]; |
485 [mazeSizeCommand release]; |
480 [mazeSizeCommand release]; |
486 [themeCommand release]; |
481 [themeCommand release]; |