project_files/HedgewarsMobile/Classes/GameConfigViewController.m
author koda
Sun, 20 Jun 2010 23:05:11 +0200
changeset 3525 1d7b056ff866
parent 3523 6592fbb969da
child 3546 ccf4854df294
permissions -rw-r--r--
some memory caring code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     1
    //
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     2
//  GameConfigViewController.m
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     3
//  HedgewarsMobile
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     4
//
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     5
//  Created by Vittorio on 18/04/10.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     7
//
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     8
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     9
#import "GameConfigViewController.h"
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    10
#import "SDL_uikitappdelegate.h"
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    11
#import "CommodityFunctions.h"
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    12
#import "MapConfigViewController.h"
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
    13
#import "TeamConfigViewController.h"
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    14
#import "SchemeWeaponConfigViewController.h"
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    15
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    16
@implementation GameConfigViewController
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    17
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    18
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    19
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    20
    return rotationManager(interfaceOrientation);
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    21
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    22
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    23
-(IBAction) buttonPressed:(id) sender {
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
    24
    // works even if it's not actually a button
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    25
    UIButton *theButton = (UIButton *)sender;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    26
    switch (theButton.tag) {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    27
        case 0:
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    28
            [[self parentViewController] dismissModalViewControllerAnimated:YES];
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    29
            break;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    30
        case 1:
3523
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    31
            theButton.enabled = NO;
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    32
            [self performSelector:@selector(startGame:)
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    33
                       withObject:theButton
3364
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    34
                       afterDelay:0.25];
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    35
            break;
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    36
        default:
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    37
            break;
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    38
    }
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    39
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    40
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    41
-(IBAction) segmentPressed:(id) sender {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    42
    UISegmentedControl *theSegment = (UISegmentedControl *)sender;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
    43
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    44
    switch (theSegment.selectedSegmentIndex) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    45
        case 0:
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    46
            // this init here is just aestetic as this controller was already set up in viewDidLoad
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    47
            if (mapConfigViewController == nil) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    48
                mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    49
            }
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    50
            activeController = mapConfigViewController;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    51
            break;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    52
        case 1:
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    53
            if (teamConfigViewController == nil) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    54
                teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    55
                // this message is compulsory otherwise the table won't be loaded at all
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    56
            }
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    57
            activeController = teamConfigViewController;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    58
            break;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    59
        case 2:
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    60
            if (schemeWeaponConfigViewController == nil) {
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    61
                schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    62
            }
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    63
            activeController = schemeWeaponConfigViewController;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    64
            break;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    65
    }
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    66
    
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    67
    // this message is compulsory otherwise the table won't be loaded at all
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
    68
    [activeController viewWillAppear:NO];      
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    69
    [self.view addSubview:activeController.view];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    70
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    71
3523
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    72
-(void) startGame:(UIButton *)button {
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    73
    button.enabled = YES;
6592fbb969da fix zoom smoothness
koda
parents: 3514
diff changeset
    74
3490
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    75
    // don't start playing if the preview is in progress
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    76
    if ([mapConfigViewController busy]) {
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    77
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    78
                                                        message:NSLocalizedString(@"Before playing the preview needs to be generated",@"")
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    79
                                                       delegate:nil
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    80
                                              cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    81
                                              otherButtonTitles:nil];
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    82
        [alert show];
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    83
        [alert release];
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    84
        return;
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    85
    }
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
    86
    
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    87
    // play only if there is more than one team
3364
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    88
    if ([teamConfigViewController.listOfSelectedTeams count] < 2) {
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    89
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"")
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    90
                                                        message:NSLocalizedString(@"You need to select at least two teams to play a game",@"")
3364
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    91
                                                       delegate:nil
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    92
                                              cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    93
                                              otherButtonTitles:nil];
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    94
        [alert show];
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    95
        [alert release];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    96
        return;
3364
e5403e2bf02c no more hardcoded teams, team selection is real \o/
koda
parents: 3361
diff changeset
    97
    }
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    98
    
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
    99
    // play if there's room for enough hogs in the selected map
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   100
    int hogs = 0;
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   101
    for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams)
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   102
        hogs += [[teamData objectForKey:@"number"] intValue];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   103
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   104
    if (hogs > mapConfigViewController.maxHogs) {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   105
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"")
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   106
                                                        message:NSLocalizedString(@"The map you selected is too small for that many hogs",@"")
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   107
                                                       delegate:nil
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   108
                                              cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   109
                                              otherButtonTitles:nil];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   110
        [alert show];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   111
        [alert release];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   112
        return;
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
   113
    }
3490
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   114
    
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   115
    // create the configuration file that is going to be sent to engine
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   116
    NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command",
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
   117
                                                                      mapConfigViewController.templateFilterCommand,@"templatefilter_command",
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
   118
                                                                      mapConfigViewController.mapGenCommand,@"mapgen_command",
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
   119
                                                                      mapConfigViewController.mazeSizeCommand,@"mazesize_command",
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   120
                                                                      mapConfigViewController.themeCommand,@"theme_command",
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   121
                                                                      teamConfigViewController.listOfSelectedTeams,@"teams_list",
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   122
                                                                      schemeWeaponConfigViewController.selectedScheme,@"scheme",
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   123
                                                                      schemeWeaponConfigViewController.selectedWeapon,@"weapon",
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   124
                                                                      nil];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   125
    [dict writeToFile:GAMECONFIG_FILE() atomically:YES];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   126
    [dict release];
3490
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   127
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   128
    // finally launch game and remove this controller
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   129
    [[self parentViewController] dismissModalViewControllerAnimated:YES];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   130
    [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   131
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   132
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   133
-(void) viewDidLoad {
3525
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   134
    CGRect screen = [[UIScreen mainScreen] bounds];
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   135
    self.view.frame = CGRectMake(0, 0, screen.size.height, screen.size.width);
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   136
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   137
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   138
        if (mapConfigViewController == nil)
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   139
            mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPad" bundle:nil];
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   140
        if (teamConfigViewController == nil)
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   141
            teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStylePlain];
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   142
        teamConfigViewController.view.frame = CGRectMake(0, 224, 300, 500);
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   143
        teamConfigViewController.view.backgroundColor = [UIColor clearColor];
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   144
        [mapConfigViewController.view addSubview:teamConfigViewController.view];
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   145
        if (schemeWeaponConfigViewController == nil)
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   146
            schemeWeaponConfigViewController = [[SchemeWeaponConfigViewController alloc] initWithStyle:UITableViewStyleGrouped];
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   147
        schemeWeaponConfigViewController.view.frame = CGRectMake(362, 224, 300, 500);
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   148
        schemeWeaponConfigViewController.view.backgroundColor = [UIColor clearColor];
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   149
        [mapConfigViewController.view addSubview:schemeWeaponConfigViewController.view];
3525
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   150
        for (UIView *oneView in self.view.subviews) {
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   151
            if ([oneView isMemberOfClass:[UIToolbar class]]) {
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   152
                [[oneView viewWithTag:12345] setHidden:YES];
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   153
                break;
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   154
            }
1d7b056ff866 some memory caring code
koda
parents: 3523
diff changeset
   155
        }
3374
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   156
    } else
0d522416d97f lazy loading for all the tables with images (might affect performance but ui feels much more responsive)
koda
parents: 3373
diff changeset
   157
        mapConfigViewController = [[MapConfigViewController alloc] initWithNibName:@"MapConfigViewController-iPhone" bundle:nil];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   158
    activeController = mapConfigViewController;
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   159
    
3369
c7289e42f0ee add other controls for map preview, also fix a bug in digest
koda
parents: 3365
diff changeset
   160
    [self.view addSubview:mapConfigViewController.view];
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   161
    
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   162
    [super viewDidLoad];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   163
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   164
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   165
-(void) viewWillAppear:(BOOL)animated {
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   166
    [mapConfigViewController viewWillAppear:animated];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   167
    [teamConfigViewController viewWillAppear:animated];
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   168
    [schemeWeaponConfigViewController viewWillAppear:animated];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   169
    // ADD other controllers here
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   170
     
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   171
    [super viewWillAppear:animated];
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   172
}
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   173
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   174
-(void) viewDidAppear:(BOOL)animated {
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   175
    [mapConfigViewController viewDidAppear:animated];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   176
    [teamConfigViewController viewDidAppear:animated];
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   177
    [schemeWeaponConfigViewController viewDidAppear:animated];
3373
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   178
    [super viewDidAppear:animated];
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   179
}
c1ff724a5c34 use a proper bundle identifier
koda
parents: 3369
diff changeset
   180
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   181
-(void) didReceiveMemoryWarning {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   182
    // Releases the view if it doesn't have a superview.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   183
    [super didReceiveMemoryWarning];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   184
    // Release any cached data, images, etc that aren't in use.
3490
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   185
    if (mapConfigViewController.view.superview == nil) 
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3374
diff changeset
   186
        mapConfigViewController = nil;
b1d00f1950c8 add some memory aware code
koda
parents: 3374
diff changeset
   187
    if (teamConfigViewController.view.superview == nil)
b1d00f1950c8 add some memory aware code
koda
parents: 3374
diff changeset
   188
        teamConfigViewController = nil;
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   189
    if (schemeWeaponConfigViewController.view.superview == nil)
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   190
        schemeWeaponConfigViewController = nil;
3487
b1d00f1950c8 add some memory aware code
koda
parents: 3374
diff changeset
   191
    activeController = nil;
b1d00f1950c8 add some memory aware code
koda
parents: 3374
diff changeset
   192
    MSG_MEMCLEAN();
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   193
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   194
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   195
-(void) viewDidUnload {
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   196
    activeController = nil;
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   197
    mapConfigViewController = nil;
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   198
    teamConfigViewController = nil;
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   199
    schemeWeaponConfigViewController = nil;
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   200
    [super viewDidUnload];
3490
016b3172b645 a bunch of minor stuff
koda
parents: 3487
diff changeset
   201
    MSG_DIDUNLOAD();
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   202
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   203
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   204
-(void) dealloc {
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   205
    [activeController release];
3365
37ac593e9027 wow all these files only for land preview and seed generation
koda
parents: 3364
diff changeset
   206
    [mapConfigViewController release];
3361
cfc6cd502f85 buttons for number of hogs in game config
koda
parents: 3356
diff changeset
   207
    [teamConfigViewController release];
3513
f589230fa21b now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents: 3490
diff changeset
   208
    [schemeWeaponConfigViewController release];
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   209
    [super dealloc];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   210
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   211
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   212
@end