project_files/HedgewarsMobile/Classes/LevelViewController.m
author koda
Fri, 12 Nov 2010 23:59:40 +0100
changeset 4284 57a501a69e5f
parent 4149 51200479f9d8
child 4476 4bf74e158f44
permissions -rw-r--r--
update iFrontend with new schemes and weaps, fix up smaller glitches
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
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
     3
 * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
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
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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
 * File created on 02/04/2010.
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    19
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3697
diff changeset
    20
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    21
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    22
#import "LevelViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
#import "CommodityFunctions.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
@implementation LevelViewController
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
@synthesize teamDictionary, levelArray, levelSprites, lastIndexPath;
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
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    31
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
#pragma mark View lifecycle
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    37
-(void) viewDidLoad {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
    [super viewDidLoad];
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
    39
    srandom(time(NULL));
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    41
    NSArray *array = [[NSArray alloc] initWithObjects:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    42
                      NSLocalizedString(@"Brutal",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    43
                      NSLocalizedString(@"Aggressive",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    44
                      NSLocalizedString(@"Bully",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    45
                      NSLocalizedString(@"Average",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    46
                      NSLocalizedString(@"Weaky",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    47
                      nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    48
    self.levelArray = array;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    49
    [array release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    50
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
    51
    self.title = NSLocalizedString(@"Set difficulty level",@"");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    52
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    53
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    54
-(void) viewWillAppear:(BOOL)animated {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    55
    [super viewWillAppear:animated];
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    56
    
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    57
    if ([[[[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0] objectForKey:@"level"] intValue] == 0)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    58
        numberOfSections = 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    59
    else
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    60
        numberOfSections = 2;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    61
    
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    62
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
    // this moves the tableview to the top
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    64
    [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
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
-(void) viewWillDisappear:(BOOL)animated {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    68
 // stuff like checking that at least 1 field was selected   
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    69
}
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    70
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    74
    return numberOfSections;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    75
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    76
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    77
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    78
    if (section == 0)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    79
        return 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    80
    else
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    81
        return 5;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
// Customize the appearance of table view cells.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    86
    static NSString *CellIdentifier0 = @"Cell0";
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    87
    static NSString *CellIdentifier1 = @"Cell1";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    88
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    89
    NSInteger row = [indexPath row];
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    90
    NSInteger section = [indexPath section];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    91
    UITableViewCell *cell;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    92
    
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    93
    if (section == 0) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    94
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    95
        if (cell == nil) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    96
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    97
            UISwitch *theSwitch = [[UISwitch alloc] init];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    98
            [theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
    99
            cell.accessoryView = theSwitch;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   100
            [theSwitch release];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   101
        }
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
   102
        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
   103
        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
   104
            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
   105
        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
   106
            theSwitch.on = YES;
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   107
        cell.textLabel.text = NSLocalizedString(@"Hogs controlled by AI",@"");
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 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   110
        if (cell == nil)
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   111
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   112
        
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   113
        cell.textLabel.text = [levelArray objectAtIndex:row];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   114
        NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   115
        if ([[hog objectForKey:@"level"] intValue] == row+1) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   116
            cell.accessoryType = UITableViewCellAccessoryCheckmark;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   117
            self.lastIndexPath = indexPath;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   118
        } else {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   119
            cell.accessoryType = UITableViewCellAccessoryNone;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   120
        }
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   121
        
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   122
        NSString *botlevelPath = [[NSString alloc] initWithFormat:@"%@/%d.png",BOTLEVELS_DIRECTORY(),row+1];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   123
        UIImage *levelImage = [[UIImage alloc] initWithContentsOfFile:botlevelPath];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   124
        [botlevelPath release];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   125
        cell.imageView.image = levelImage;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   126
        [levelImage release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
    }
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   128
    
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   132
-(void) switchValueChanged:(id) sender {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   133
    UISwitch *theSwitch = (UISwitch *)sender;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   134
    NSIndexSet *sections = [[NSIndexSet alloc] initWithIndex:1];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   135
    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
   136
    NSInteger level;
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   137
    
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   138
    if (theSwitch.on) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   139
        numberOfSections = 2;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   140
        [self.tableView insertSections:sections withRowAnimation:UITableViewRowAnimationFade];
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
   141
        level = 1 + (random() % ([levelArray count] - 1));
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   142
    } else {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   143
        numberOfSections = 1;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   144
        [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
   145
        level = 0;
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   146
    }
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   147
    [sections release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
3923
694e6f6e0e30 various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents: 3883
diff changeset
   149
    DLog(@"New level is %d",level);
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   150
    for (NSMutableDictionary *hog in hogs)
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
   151
        [hog setObject:[NSNumber numberWithInt:level] forKey:@"level"];
3883
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   152
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   153
    [self.tableView reloadData];
5934ddf9ed5d fixed the voice selection where you couldn't hear a preview sound
koda
parents: 3880
diff changeset
   154
    [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   156
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   158
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
#pragma mark Table view delegate
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   160
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
    int newRow = [indexPath row];
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   162
    int oldRow = (self.lastIndexPath != nil) ? [self.lastIndexPath row] : -1;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   163
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   164
    if ([indexPath section] != 0) { 
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   165
        if (newRow != oldRow) {
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   166
            NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   167
            
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   168
            NSInteger level = newRow + 1;
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   169
            for (NSMutableDictionary *hog in hogs)
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   170
                [hog setObject:[NSNumber numberWithInt:level] forKey:@"level"];
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4149
diff changeset
   171
            DLog(@"New level is %d",level);
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   172
            
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   173
            // tell our boss to write this new stuff on disk
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   174
            [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   175
            [self.tableView reloadData];
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   176
            
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   177
            self.lastIndexPath = indexPath;
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   178
            [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   179
        }
3880
24810907e853 rework the AI level selection
koda
parents: 3829
diff changeset
   180
        [self.navigationController popViewControllerAnimated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   186
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
-(void) didReceiveMemoryWarning {
3971
5c82ee165ed5 minor stuff
koda
parents: 3923
diff changeset
   189
    self.lastIndexPath = nil;
5c82ee165ed5 minor stuff
koda
parents: 3923
diff changeset
   190
    MSG_MEMCLEAN();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   191
    [super didReceiveMemoryWarning];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
-(void) viewDidUnload {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
    self.lastIndexPath = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
    self.teamDictionary = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    self.levelArray = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
    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
   199
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   202
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   203
-(void) dealloc {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   204
    [levelArray release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   205
    [levelSprites release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   206
    [teamDictionary release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   207
    [lastIndexPath release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   208
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   209
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   210
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   211
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   212
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   213