project_files/HedgewarsMobile/Classes/LevelViewController.m
author Wuzzy <almikes@aol.com>
Tue, 02 May 2017 21:16:07 +0200
changeset 12390 c051ac2544f2
parent 11217 e68b3e392091
child 12872 00215a7ec5f5
permissions -rw-r--r--
Add note in Diver scenario that jetpack only has 50% fuel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     1
/*
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
6700
e04da46ee43c the most important commit of the year
koda
parents: 6078
diff changeset
     3
 * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     4
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     8
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    12
 * GNU General Public License for more details.
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    13
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    14
 * You should have received a copy of the GNU General Public License
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 8441
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    17
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    18
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    19
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    20
#import "LevelViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
@implementation LevelViewController
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
@synthesize teamDictionary, levelArray, levelSprites, lastIndexPath;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    28
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    29
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    30
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    31
#pragma mark View lifecycle
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    32
-(void) viewDidLoad {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
    [super viewDidLoad];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
    NSArray *array = [[NSArray alloc] initWithObjects:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
                      NSLocalizedString(@"Brutal",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    37
                      NSLocalizedString(@"Aggressive",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
                      NSLocalizedString(@"Bully",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    39
                      NSLocalizedString(@"Average",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
                      NSLocalizedString(@"Weaky",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    41
                      nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    42
    self.levelArray = array;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    43
    [array release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    44
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3547
diff changeset
    45
    self.title = NSLocalizedString(@"Set difficulty level",@"");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    46
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    47
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    48
-(void) viewWillAppear:(BOOL)animated {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    49
    [super viewWillAppear:animated];
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
    50
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    51
    if ([[[[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0] objectForKey:@"level"] intValue] == 0)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    52
        numberOfSections = 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    53
    else
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    54
        numberOfSections = 2;
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
    55
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    56
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    57
    // this moves the tableview to the top
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    58
    [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    59
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    60
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    61
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    62
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    64
    return numberOfSections;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    65
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    67
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    68
    if (section == 0)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    69
        return 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    70
    else
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    71
        return 5;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    75
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    76
    static NSString *CellIdentifier0 = @"Cell0";
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    77
    static NSString *CellIdentifier1 = @"Cell1";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    78
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
    NSInteger row = [indexPath row];
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    80
    NSInteger section = [indexPath section];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    81
    UITableViewCell *cell;
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
    82
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    83
    if (section == 0) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    84
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    85
        if (cell == nil) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    86
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    87
            UISwitch *theSwitch = [[UISwitch alloc] init];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    88
            [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    89
            cell.accessoryView = theSwitch;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    90
            [theSwitch release];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    91
        }
4149
51200479f9d8 update ios port with new health modes, increase sd turns, new game modes, fixed bugs that prevented the creation of AI controlled teams, revisited update modes
koda
parents: 3971
diff changeset
    92
        UISwitch *theSwitch = (UISwitch *)cell.accessoryView;
51200479f9d8 update ios port with new health modes, increase sd turns, new game modes, fixed bugs that prevented the creation of AI controlled teams, revisited update modes
koda
parents: 3971
diff changeset
    93
        if (numberOfSections == 1)
51200479f9d8 update ios port with new health modes, increase sd turns, new game modes, fixed bugs that prevented the creation of AI controlled teams, revisited update modes
koda
parents: 3971
diff changeset
    94
            theSwitch.on = NO;
51200479f9d8 update ios port with new health modes, increase sd turns, new game modes, fixed bugs that prevented the creation of AI controlled teams, revisited update modes
koda
parents: 3971
diff changeset
    95
        else
51200479f9d8 update ios port with new health modes, increase sd turns, new game modes, fixed bugs that prevented the creation of AI controlled teams, revisited update modes
koda
parents: 3971
diff changeset
    96
            theSwitch.on = YES;
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    97
        cell.textLabel.text = NSLocalizedString(@"Hogs controlled by AI",@"");
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    98
    } else {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    99
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   100
        if (cell == nil)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   101
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   102
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   103
        cell.textLabel.text = [levelArray objectAtIndex:row];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   104
        NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   105
        if ([[hog objectForKey:@"level"] intValue] == row+1) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   106
            cell.accessoryType = UITableViewCellAccessoryCheckmark;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   107
            self.lastIndexPath = indexPath;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   108
        } else {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   109
            cell.accessoryType = UITableViewCellAccessoryNone;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   110
        }
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   111
5982
283be2ca54a7 mad several updates to the resource copying phase in the ios project file, changed paths of some images and added some smaller forts version
koda
parents: 5208
diff changeset
   112
        NSString *botlevelPath = [[NSString alloc] initWithFormat:@"%@/bot%d.png",[[NSBundle mainBundle] resourcePath],row+1];
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   113
        UIImage *levelImage = [[UIImage alloc] initWithContentsOfFile:botlevelPath];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   114
        [botlevelPath release];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   115
        cell.imageView.image = levelImage;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   116
        [levelImage release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   117
    }
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   118
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   119
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   120
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   122
-(void) switchValueChanged:(id) sender {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   123
    UISwitch *theSwitch = (UISwitch *)sender;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   124
    NSIndexSet *sections = [[NSIndexSet alloc] initWithIndex:1];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   125
    NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   126
    NSInteger level;
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   127
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   128
    if (theSwitch.on) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   129
        numberOfSections = 2;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   130
        [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
11206
2e80c9861818 - Better random number generation for front-end: random() replaced with arc4random_uniform()
antonc27 <antonc27@mail.ru>
parents: 11148
diff changeset
   131
        level = 1 + arc4random_uniform((int)[levelArray count] - 1);
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   132
    } else {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   133
        numberOfSections = 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   134
        [self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   135
        level = 0;
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   136
    }
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   137
    [sections release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   138
11148
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   139
    DLog(@"New level is %ld", (long)level);
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   140
    for (NSMutableDictionary *hog in hogs)
11148
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   141
        [hog setObject:[NSNumber numberWithInteger:level] forKey:@"level"];
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   142
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   143
    [self.tableView reloadData];
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   144
    [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   145
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
#pragma mark Table view delegate
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   150
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
11148
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   151
    NSInteger newRow = [indexPath row];
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   152
    NSInteger oldRow = (self.lastIndexPath != nil) ? [self.lastIndexPath row] : -1;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   153
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   154
    if ([indexPath section] != 0) {
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   155
        if (newRow != oldRow) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   156
            NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   157
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   158
            NSInteger level = newRow + 1;
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   159
            for (NSMutableDictionary *hog in hogs)
11148
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   160
                [hog setObject:[NSNumber numberWithInteger:level] forKey:@"level"];
064a53861759 - Refactoring in order to remove some warning related to using of int instead of NSInteger
antonc27 <antonc27@mail.ru>
parents: 10108
diff changeset
   161
            DLog(@"New level is %ld", (long)level);
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   162
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   163
            // tell our boss to write this new stuff on disk
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   164
            [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   165
            [self.tableView reloadData];
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6832
diff changeset
   166
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   167
            self.lastIndexPath = indexPath;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   168
            [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   169
        }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   170
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   171
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   172
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   173
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   174
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   175
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   176
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   177
-(void) didReceiveMemoryWarning {
3971
5c82ee165ed5 minor stuff
koda
parents: 3923
diff changeset
   178
    self.lastIndexPath = nil;
5c82ee165ed5 minor stuff
koda
parents: 3923
diff changeset
   179
    MSG_MEMCLEAN();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   180
    [super didReceiveMemoryWarning];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
-(void) viewDidUnload {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
    self.lastIndexPath = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185
    self.teamDictionary = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   186
    self.levelArray = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
    self.levelSprites = nil;
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3547
diff changeset
   188
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   189
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   191
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
-(void) dealloc {
5208
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   193
    releaseAndNil(levelArray);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   194
    releaseAndNil(levelSprites);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   195
    releaseAndNil(teamDictionary);
878e551f0b4a all together now! releaseAndNil ftw
koda
parents: 4976
diff changeset
   196
    releaseAndNil(lastIndexPath);
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   199
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   202