project_files/HedgewarsMobile/Classes/SingleTeamViewController.m
author koda
Sun, 10 Oct 2010 03:16:25 +0200
changeset 3941 017b2b31e1c6
parent 3926 668b71f31e51
child 3948 24daa33a3114
permissions -rw-r--r--
integrate nicely with external display
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     1
/*
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     3
 * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     4
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
81db3c85784b headers ftw, also right project file
koda
parents: 3825
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: 3825
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     8
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    12
 * GNU General Public License for more details.
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    13
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    14
 * You should have received a copy of the GNU General Public License
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    15
 * along with this program; if not, write to the Free Software
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    17
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    18
 * File created on 02/04/2010.
81db3c85784b headers ftw, also right project file
koda
parents: 3825
diff changeset
    19
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3825
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 "SingleTeamViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
#import "HogHatViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
#import "GravesViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
#import "VoicesViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
#import "FortsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    27
#import "FlagsViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    28
#import "LevelViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    29
#import "CommodityFunctions.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    30
#import "UIImageExtra.h"
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3924
diff changeset
    31
#import "PascalImports.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    33
#define TEAMNAME_TAG 78789
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
@implementation SingleTeamViewController
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    36
@synthesize teamDictionary, normalHogSprite, secondaryItems, moreSecondaryItems, teamName;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    37
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    39
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    40
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    41
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    42
#pragma mark -
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    43
#pragma mark editableCellViewDelegate methods
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    44
// set the new value
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    45
-(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    46
    if (TEAMNAME_TAG == tagValue) {
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    47
        // delete old file
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    48
        [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName] error:NULL];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    49
        // update filename
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    50
        self.teamName = textString;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    51
        // save new file
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    52
        [self writeFile];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    53
    } else {
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    54
        // replace the old value with the new one
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    55
        NSMutableDictionary *hog = [[teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:tagValue];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    56
        [hog setObject:textString forKey:@"hogname"];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    57
        isWriteNeeded = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    58
    }
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 View lifecycle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
-(void) viewDidLoad {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    64
    [super viewDidLoad];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    65
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
    // labels for the entries
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
    NSArray *array = [[NSArray alloc] initWithObjects:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    68
                      NSLocalizedString(@"Grave",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    69
                      NSLocalizedString(@"Voice",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    70
                      NSLocalizedString(@"Fort",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
                      NSLocalizedString(@"Flag",@""),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
                      NSLocalizedString(@"Level",@""),nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
    self.secondaryItems = array;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
    [array release];
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    75
    
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    76
    // labels for the subtitles
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    77
    NSArray *moreArray = [[NSArray alloc] initWithObjects:
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    78
                          NSLocalizedString(@"Mark the death of your fallen warriors",@""),
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    79
                          NSLocalizedString(@"Pick a slang your hogs will speak",@""),
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    80
                          NSLocalizedString(@"Select the team invincible fortress (only valid for fort games)",@""),
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    81
                          NSLocalizedString(@"Choose a charismatic symbol for your team",@""),
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    82
                          NSLocalizedString(@"Opt for controlling the team or let the AI lead",@""),nil];
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    83
    self.moreSecondaryItems = moreArray;
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
    84
    [moreArray release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
    // load the base hog image, drawing will occure in cellForRow...
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
    NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/Hedgehog.png",GRAPHICS_DIRECTORY()];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    88
    UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile andCutAt:CGRectMake(96, 0, 32, 32)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    89
    [normalHogFile release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    90
    self.normalHogSprite = hogSprite;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    91
    [hogSprite release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    92
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    93
    // listen if any childController modifies the plist and write it if needed
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    94
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    95
    isWriteNeeded = NO;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    96
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
    97
    self.title = NSLocalizedString(@"Edit team settings",@"");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    98
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    99
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   100
-(void) viewWillAppear:(BOOL)animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   101
    [super viewWillAppear:animated];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   102
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   103
    // load data about the team and write if there has been a change from other childControllers
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   104
    if (isWriteNeeded)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   105
        [self writeFile];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   106
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   107
    NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   108
    NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   109
    self.teamDictionary = teamDict;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   110
    [teamDict release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   111
    [teamFile release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   112
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   113
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   114
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   115
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   116
// write on file if there has been a change
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   117
-(void) viewWillDisappear:(BOOL)animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   118
    [super viewWillDisappear:animated];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   119
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   120
    if (isWriteNeeded)
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   121
        [self writeFile];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   122
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   125
// needed by other classes to warn about a user change
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
-(void) setWriteNeeded {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
    isWriteNeeded = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   128
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
-(void) writeFile {
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   131
    NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   132
    [self.teamDictionary writeToFile:teamFile atomically:YES];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   133
    [teamFile release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
3789
c3eb56754e92 added a smaller version of forts, fixed a couple of regressions
koda
parents: 3783
diff changeset
   135
    //DLog(@"%@",teamDictionary);
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   136
    isWriteNeeded = NO;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   138
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   139
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   140
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   142
    return 3;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   143
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   144
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   145
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
    NSInteger rows = 0;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
    switch (section) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
        case 0: // team name
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
            rows = 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   150
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   151
        case 1: // team members
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3924
diff changeset
   152
            rows = HW_getMaxNumberOfHogs();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   153
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   154
        case 2: // team details
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
            rows = [self.secondaryItems count];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   156
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
        default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   158
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   160
    return rows;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   162
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   163
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   164
    NSString *sectionTitle = nil;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   165
    switch (section) {
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   166
        case 0:
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   167
            sectionTitle = NSLocalizedString(@"Team Name", @"");
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   168
            break;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   169
        case 1:
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   170
            sectionTitle = NSLocalizedString(@"Names and Hats", @"");
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   171
            break;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   172
        case 2:
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   173
            sectionTitle = NSLocalizedString(@"Team Preferences", @"");
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   174
            break;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   175
        default:
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   176
            DLog(@"Nope");
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   177
            break;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   178
    }
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   179
    return sectionTitle;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   180
}
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   181
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
    static NSString *CellIdentifier0 = @"Cell0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   184
    static NSString *CellIdentifier1 = @"Cell1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   185
    static NSString *CellIdentifier2 = @"Cell2";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   186
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
    NSArray *hogArray;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
    UITableViewCell *cell = nil;
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   189
    EditableCellView *editableCell = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
    NSInteger row = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   191
    UIImage *accessoryImage;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   192
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
    switch ([indexPath section]) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
        case 0:
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   195
            editableCell = (EditableCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier0];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   196
            if (editableCell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   197
                editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
                                               reuseIdentifier:CellIdentifier0] autorelease];
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   199
                editableCell.delegate = self;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   200
                editableCell.tag = TEAMNAME_TAG;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   201
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   202
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   203
            editableCell.imageView.image = nil;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   204
            editableCell.accessoryType = UITableViewCellAccessoryNone;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   205
            editableCell.textField.text = self.teamName;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   206
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   207
            cell = editableCell;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   208
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   209
        case 1:
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   210
            editableCell = (EditableCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   211
            if (editableCell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   212
                editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   213
                                               reuseIdentifier:CellIdentifier1] autorelease];
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   214
                editableCell.delegate = self;
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   215
                editableCell.tag = [indexPath row];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   216
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   217
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   218
            hogArray = [self.teamDictionary objectForKey:@"hedgehogs"];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   219
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   220
            // draw the hat on top of the hog
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   221
            NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@.png", HATS_DIRECTORY(), [[hogArray objectAtIndex:row] objectForKey:@"hat"]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   222
            UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
            [hatFile release];
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   224
            editableCell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, -5)];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   225
            [hatSprite release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   226
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   227
            editableCell.textField.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   228
            editableCell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   229
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   230
            cell = editableCell;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   231
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   232
        case 2:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   233
            cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   234
            if (cell == nil) {
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   235
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   236
                                               reuseIdentifier:CellIdentifier2] autorelease];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   237
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   238
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   239
            cell.textLabel.text = [self.secondaryItems objectAtIndex:row];
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   240
            cell.detailTextLabel.text = [self.moreSecondaryItems objectAtIndex:row];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   241
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   242
            switch (row) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   243
                case 0: // grave
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   244
                    accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   245
                                                                              GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]]
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   246
                                                                    andCutAt:CGRectMake(0,0,32,32)];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   247
                    cell.imageView.image = accessoryImage;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   248
                    [accessoryImage release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   249
                    break;
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   250
                case 1: // voice
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   251
                    accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/HellishBomb.png",
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   252
                                                                              GRAPHICS_DIRECTORY()]];
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   253
                    cell.imageView.image = accessoryImage;
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   254
                    [accessoryImage release];
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   255
                    break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   256
                case 2: // fort
3789
c3eb56754e92 added a smaller version of forts, fixed a couple of regressions
koda
parents: 3783
diff changeset
   257
                    accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@-preview.png",
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   258
                                                                              FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]];
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   259
                    cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(32, 32)];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   260
                    [accessoryImage release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   261
                    break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   262
                case 3: // flags
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   263
                    accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   264
                                                                              FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]];
3825
fd6c20cd90e3 typos, reduced sound size and last minute fixes
koda
parents: 3816
diff changeset
   265
                    cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(27, 19)];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   266
                    [accessoryImage release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   267
                    break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   268
                case 4: // level
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   269
                    accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%d.png",
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   270
                                                                              BOTLEVELS_DIRECTORY(),[[[[teamDictionary objectForKey:@"hedgehogs"]
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   271
                                                                                                      objectAtIndex:0] objectForKey:@"level"]
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   272
                                                                                                     intValue]]];
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   273
                    cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(32, 32)];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   274
                    [accessoryImage release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   275
                    break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   276
                default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   277
                    cell.imageView.image = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   278
                    break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   279
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   280
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   281
    }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   282
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   283
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   284
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   285
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   286
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   287
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   288
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   289
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   290
    NSInteger row = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   291
    NSInteger section = [indexPath section];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   292
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   293
    if (2 == section) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   294
        switch (row) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   295
            case 0: // grave
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   296
                if (nil == gravesViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   297
                    gravesViewController = [[GravesViewController alloc] initWithStyle:UITableViewStyleGrouped];
3924
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   298
                
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   299
                [gravesViewController setTeamDictionary:teamDictionary];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   300
                [self.navigationController pushViewController:gravesViewController animated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   301
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   302
            case 1: // voice
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   303
                if (nil == voicesViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   304
                    voicesViewController = [[VoicesViewController alloc] initWithStyle:UITableViewStyleGrouped];
3924
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   305
                
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   306
                [voicesViewController setTeamDictionary:teamDictionary];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   307
                [self.navigationController pushViewController:voicesViewController animated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   308
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   309
            case 2: // fort
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   310
                if (nil == fortsViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   311
                    fortsViewController = [[FortsViewController alloc] initWithStyle:UITableViewStyleGrouped];
3924
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   312
                
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   313
                [fortsViewController setTeamDictionary:teamDictionary];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   314
                [self.navigationController pushViewController:fortsViewController animated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   315
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   316
            case 3: // flag
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   317
                if (nil == flagsViewController)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   318
                    flagsViewController = [[FlagsViewController alloc] initWithStyle:UITableViewStyleGrouped];
3924
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   319
                
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   320
                [flagsViewController setTeamDictionary:teamDictionary];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   321
                [self.navigationController pushViewController:flagsViewController animated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   322
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   323
            case 4: // level
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   324
                if (nil == levelViewController)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   325
                    levelViewController = [[LevelViewController alloc] initWithStyle:UITableViewStyleGrouped];
3924
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   326
                
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   327
                [levelViewController setTeamDictionary:teamDictionary];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   328
                [self.navigationController pushViewController:levelViewController animated:YES];
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   329
                break;
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   330
            default:
2a9ace189288 WIP for an objc ammomenu implementation
koda
parents: 3829
diff changeset
   331
                DLog(@"Nope");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   332
                break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   333
        }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   334
    } else {
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   335
        EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   336
        [cell replyKeyboard];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   337
        [aTableView deselectRowAtIndexPath:indexPath animated:NO];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   338
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   339
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   340
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   341
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   342
// action to perform when you want to change a hog hat
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   343
-(void) tableView:(UITableView *)aTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   344
    if (nil == hogHatViewController)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   345
        hogHatViewController = [[HogHatViewController alloc] initWithStyle:UITableViewStyleGrouped];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   346
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   347
    // cache the dictionary file of the team, so that other controllers can modify it
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   348
    hogHatViewController.teamDictionary = self.teamDictionary;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   349
    hogHatViewController.selectedHog = [indexPath row];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   350
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   351
    // if we are editing the field undo any change before proceeding
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   352
    EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   353
    [cell cancel:nil];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   354
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   355
    [self.navigationController pushViewController:hogHatViewController animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   356
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   357
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   358
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   359
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   360
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   361
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   362
    [super didReceiveMemoryWarning];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   363
    if (hogHatViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   364
        hogHatViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   365
    if (gravesViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   366
        gravesViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   367
    if (voicesViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   368
        voicesViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   369
    if (fortsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   370
        fortsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   371
    if (flagsViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   372
        flagsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   373
    if (levelViewController.view.superview == nil)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   374
        levelViewController = nil;
3660
bc125bea5849 complete settings page rework
koda
parents: 3659
diff changeset
   375
    MSG_MEMCLEAN();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   376
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   377
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   378
-(void) viewDidUnload {
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3697
diff changeset
   379
    [[NSNotificationCenter defaultCenter] removeObserver:self];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   380
    self.teamDictionary = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   381
    self.teamName = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   382
    self.normalHogSprite = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   383
    self.secondaryItems = nil;
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   384
    self.moreSecondaryItems = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   385
    hogHatViewController = nil;
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   386
    gravesViewController = nil;
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   387
    voicesViewController = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   388
    flagsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   389
    fortsViewController = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   390
    levelViewController = nil;
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   391
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   392
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   393
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   394
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   395
-(void) dealloc {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   396
    [teamDictionary release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   397
    [teamName release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   398
    [normalHogSprite release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   399
    [secondaryItems release];
3816
7b74aa003f52 a little more intuitive team editing
koda
parents: 3789
diff changeset
   400
    [moreSecondaryItems release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   401
    [hogHatViewController release];
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   402
    [gravesViewController release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   403
    [fortsViewController release];
3662
a44406f4369b polish polish polish polish (also: panning horizontal fix, panning momentum, settings page reworked yet again, memory leaks, crashes, segfaults)
koda
parents: 3660
diff changeset
   404
    [voicesViewController release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   405
    [flagsViewController release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   406
    [levelViewController release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   407
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   408
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   409
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   410
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   411
@end
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   412