project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
author nemo
Mon, 27 Dec 2010 12:51:08 -0500
branch0.9.15
changeset 4723 29ab0d49c3e6
parent 4284 57a501a69e5f
child 4976 088d40d8aba2
permissions -rw-r--r--
Changelog entry applies to .15 too
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 23/05/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 "SingleSchemeViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
#import <QuartzCore/QuartzCore.h>
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    24
#import "CommodityFunctions.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    25
#import "UIImageExtra.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    26
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    27
#define LABEL_TAG  12345
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    28
#define SLIDER_TAG 54321
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
    29
#define SWITCH_TAG 67890
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    30
4211
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    31
#define checkValueString(detailString,labelSting,sliderRef); \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    32
    if ([labelSting isEqualToString:@"Turn Time"] && (NSInteger) sliderRef.value == 100) \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    33
        detailString = @"∞"; \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    34
    else if ([labelSting isEqualToString:@"Water Rise Amount"] && (NSInteger) sliderRef.value == 100) \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    35
        detailString = NSLocalizedString(@"Nvr",@"Short for 'Never'"); \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    36
    else if ([labelSting isEqualToString:@"Crate Drop Turns"] && (NSInteger) sliderRef.value == 0) \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    37
        detailString = NSLocalizedString(@"Nvr",@"Short for 'Never'"); \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    38
    else if ([labelSting isEqualToString:@"Mines Time"] && (NSInteger) sliderRef.value == -1) \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    39
        detailString = NSLocalizedString(@"Rnd",@"Short for 'Random'"); \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    40
    else \
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    41
        detailString = [NSString stringWithFormat:@"%d",(NSInteger) sliderRef.value];
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    42
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
    43
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    44
@implementation SingleSchemeViewController
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
    45
@synthesize schemeName, schemeDictionary, basicSettingList, gameModifierArray;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    46
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    47
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    48
    return rotationManager(interfaceOrientation);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    49
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    50
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    51
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    52
#pragma mark View lifecycle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    53
-(void) viewDidLoad {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    54
    [super viewDidLoad];
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
    55
    NSString *path = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    56
3753
bb5a0252fb56 small update for the about page
koda
parents: 3752
diff changeset
    57
    // title, description, image name (+btn)
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
    58
    path = [NSString stringWithFormat:@"%@/gameFlags_en.plist",IFRONTEND_DIRECTORY()];
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
    59
    NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    60
    self.gameModifierArray = mods;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    61
    [mods release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    62
3753
bb5a0252fb56 small update for the about page
koda
parents: 3752
diff changeset
    63
    // title, image name (+icon), default value, max value, min value
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
    64
    path = [NSString stringWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()];
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
    65
    NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:path];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    66
    self.basicSettingList = basicSettings;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
    [basicSettings release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    68
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
    69
    self.title = NSLocalizedString(@"Edit scheme preferences",@"");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    70
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
// load from file
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    73
-(void) viewWillAppear:(BOOL) animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
    [super viewWillAppear:animated];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    75
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
    76
    NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
    77
    NSMutableDictionary *scheme = [[NSMutableDictionary alloc] initWithContentsOfFile:schemeFile];
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3574
diff changeset
    78
    [schemeFile release];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
    79
    self.schemeDictionary = scheme;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
    [scheme release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    81
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
    [self.tableView reloadData];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
// save to file
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
-(void) viewWillDisappear:(BOOL) animated {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
    [super viewWillDisappear:animated];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    88
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
    89
    NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
    90
    [self.schemeDictionary writeToFile:schemeFile atomically:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    91
    [schemeFile release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    92
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    93
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    94
#pragma mark -
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
    95
#pragma mark editableCellView delegate
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    96
// set the new value
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
    97
-(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
    98
    if (tagValue == 0) {
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
    99
        // delete old file
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   100
        [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] error:NULL];
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   101
        // update filename
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   102
        self.schemeName = textString;
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   103
        // save new file
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   104
        [self.schemeDictionary writeToFile:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] atomically:YES];
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   105
    } else {
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   106
        [self.schemeDictionary setObject:textString forKey:@"description"];
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   107
    }
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   108
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   109
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   110
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   111
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   112
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   113
    return 3;
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
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   117
    switch (section) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   118
        case 0:
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   119
            return 2;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   120
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   121
        case 1:
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   122
            return [[self.schemeDictionary objectForKey:@"basic"] count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
        case 2:
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   125
            return [[self.schemeDictionary objectForKey:@"gamemod"] count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
        default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   128
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
    return 0;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   130
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   132
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   133
    static NSString *CellIdentifier0 = @"Cell0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
    static NSString *CellIdentifier1 = @"Cell1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   135
    static NSString *CellIdentifier2 = @"Cell2";
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   136
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
    UITableViewCell *cell = nil;
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   138
    EditableCellView *editableCell = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   139
    NSInteger row = [indexPath row];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   140
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
    switch ([indexPath section]) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   142
        case 0:
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   143
            editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   144
            if (editableCell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   145
                editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
                                               reuseIdentifier:CellIdentifier0] autorelease];
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   147
                editableCell.delegate = self;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
            }
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   149
            editableCell.tag = row;
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   150
            editableCell.selectionStyle = UITableViewCellSelectionStyleNone;
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   151
            editableCell.imageView.image = nil;
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   152
            editableCell.detailTextLabel.text = nil;
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   153
         
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   154
            if (row == 0) {
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   155
                editableCell.textField.text = self.schemeName;
4284
57a501a69e5f update iFrontend with new schemes and weaps, fix up smaller glitches
koda
parents: 4213
diff changeset
   156
                editableCell.textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   157
            } else {
3825
fd6c20cd90e3 typos, reduced sound size and last minute fixes
koda
parents: 3782
diff changeset
   158
                editableCell.minimumCharacters = 0;
3782
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   159
                editableCell.textField.font = [UIFont systemFontOfSize:[UIFont labelFontSize]];
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   160
                editableCell.textField.text = [self.schemeDictionary objectForKey:@"description"];
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   161
                editableCell.textField.placeholder = NSLocalizedString(@"You can add a description if you wish",@"");
dc3531e49e4c add a description field for schemes and weapons
koda
parents: 3781
diff changeset
   162
            }
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   163
            cell = editableCell;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   164
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   165
        case 1:
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   166
            cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   167
            NSDictionary *detail = [self.basicSettingList objectAtIndex:row];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   168
            // need to offset this section (see format in CommodityFunctions.m and above)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   169
            if (cell == nil) {
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   170
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   171
                                               reuseIdentifier:CellIdentifier1] autorelease];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   172
3643
858b20bafb6e reworked the ammunition configuration page (visually)
koda
parents: 3623
diff changeset
   173
                int offset = 0;
3996
eb549fd864a5 the ios port is also iphone compatible
koda
parents: 3916
diff changeset
   174
                if (IS_IPAD())
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   175
                    offset = 50;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   176
3643
858b20bafb6e reworked the ammunition configuration page (visually)
koda
parents: 3623
diff changeset
   177
                UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(offset+260, 12, offset+150, 23)];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   178
                [slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   179
                [cell.contentView addSubview:slider];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   180
                [slider release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   181
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   182
                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 7, 200, 30)];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   183
                label.tag = LABEL_TAG;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   184
                label.backgroundColor = [UIColor clearColor];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   185
                label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   186
                [cell.contentView addSubview:label];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   187
                [label release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   189
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   190
            UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",BTN_DIRECTORY(),[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]];
3623
f14db208f2fa graphics applied and fixes here and there
koda
parents: 3621
diff changeset
   191
            cell.imageView.image = img;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
            [img release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   193
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   194
            UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   195
            cellLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   196
3916
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   197
            // can't use the viewWithTag method because row is dynamic
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   198
            UISlider *cellSlider = nil;
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   199
            for (UIView *oneView in cell.contentView.subviews) {
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   200
                if ([oneView isMemberOfClass:[UISlider class]]) {
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   201
                    cellSlider = (UISlider *)oneView;
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   202
                    break;
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   203
                } 
3916
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   204
            }
e7d665a4ef42 implemented endless turns support and added Timeless scheme (also fixed a crasher)
koda
parents: 3829
diff changeset
   205
            cellSlider.tag = SLIDER_TAG + row;
4211
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   206
            cellSlider.maximumValue = [[detail objectForKey:@"max"] floatValue];
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   207
            cellSlider.minimumValue = [[detail objectForKey:@"min"] floatValue];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   208
            cellSlider.value = [[[self.schemeDictionary objectForKey:@"basic"] objectAtIndex:row] floatValue];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   209
4211
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   210
            NSString *prestring = nil;
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   211
            checkValueString(prestring,cellLabel.text,cellSlider);
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   212
4210
caa9b08990eb revert 4200:dd54999c2822 - it was breaking schemes. koda. just leave this alone until next release
nemo
parents: 4208
diff changeset
   213
            // forced to use this weird format otherwise the label disappears when size of the text is bigger than the original
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   214
            while ([prestring length] <= 4)
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   215
                prestring = [NSString stringWithFormat:@" %@",prestring];
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   216
            cell.detailTextLabel.text = prestring;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   217
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   218
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   219
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   220
        case 2:
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   221
            cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier2];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   222
            if (cell == nil) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   224
                                               reuseIdentifier:CellIdentifier2] autorelease];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   225
                UISwitch *onOff = [[UISwitch alloc] init];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   226
                [onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   227
                cell.accessoryView = onOff;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   228
                [onOff release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   229
            }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   230
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   231
            UISwitch *switcher = (UISwitch *)cell.accessoryView;
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   232
            switcher.tag = SWITCH_TAG + row;
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   233
            [switcher setOn:[[[self.schemeDictionary objectForKey:@"gamemod"] objectAtIndex:row] boolValue] animated:NO];
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   234
            
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   235
            UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",BTN_DIRECTORY(),[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   236
            cell.imageView.image = image;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   237
            [image release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   238
            [cell.imageView.layer setCornerRadius:7.0f];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   239
            [cell.imageView.layer setMasksToBounds:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   240
            cell.textLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   241
            cell.detailTextLabel.text = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"description"];
4000
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   242
            cell.detailTextLabel.adjustsFontSizeToFitWidth = YES;
ddc4a09889e7 engine: reorder GameFlags and update files, frontend and other stuff
koda
parents: 3996
diff changeset
   243
            cell.detailTextLabel.minimumFontSize = 6;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   244
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   245
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   246
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   247
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   248
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   249
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   250
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   251
-(void) toggleSwitch:(id) sender {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   252
    UISwitch *theSwitch = (UISwitch *)sender;
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   253
    NSMutableArray *array = [self.schemeDictionary objectForKey:@"gamemod"];
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   254
    [array replaceObjectAtIndex:theSwitch.tag-SWITCH_TAG withObject:[NSNumber numberWithBool:theSwitch.on]];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   255
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   256
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   257
-(void) sliderChanged:(id) sender {
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   258
    // the slider that changed is sent as object
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   259
    UISlider *theSlider = (UISlider *)sender;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   260
    // create the indexPath of the row of the slider
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   261
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:theSlider.tag-SLIDER_TAG inSection:1];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   262
    // get its cell
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   263
    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
4211
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   264
    // grab the associated labels
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   265
    UILabel *detailLabel = (UILabel *)cell.detailTextLabel;
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   266
    UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   267
    // modify it
4211
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   268
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   269
    checkValueString(detailLabel.text,cellLabel.text,theSlider);
7dcbd236ca59 this time i got it right, i'm sure of it; TEST ANYWAYS
koda
parents: 4210
diff changeset
   270
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   271
    // save changes in the main array
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   272
    NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"];
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   273
    [array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   274
}
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   275
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   276
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   277
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   278
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   279
    UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath];
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   280
    EditableCellView *editableCell = nil;
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   281
    UISlider *cellSlider = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   282
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   283
    switch ([indexPath section]) {
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   284
        case 0:
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   285
            editableCell = (EditableCellView *)cell;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   286
            [editableCell replyKeyboard];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   287
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   288
        case 1:
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   289
            cellSlider = (UISlider *)[cell.contentView viewWithTag:[indexPath row]+SLIDER_TAG];
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   290
            [cellSlider setValue:[[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] floatValue] animated:YES];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   291
            [self sliderChanged:cellSlider];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   292
            //cell.detailTextLabel.text = [[[self.basicSettingList objectAtIndex:[indexPath row]] objectForKey:@"default"] stringValue];
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   293
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   294
        case 2:
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   295
            /*sw = (UISwitch *)cell.accessoryView;
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   296
            [sw setOn:!sw.on animated:YES];
3574
78fc6e61570b insert a default name when a void string is used
koda
parents: 3573
diff changeset
   297
            [self toggleSwitch:sw];*/
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   298
            break;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   299
        default:
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   300
            break;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   301
    }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3662
diff changeset
   302
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   303
    [aTableView deselectRowAtIndexPath:indexPath animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   304
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   305
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   306
-(NSString *)tableView:(UITableView *)aTableView titleForHeaderInSection:(NSInteger)section {
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   307
    NSString *sectionTitle = nil;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   308
    switch (section) {
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   309
        case 0:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   310
            sectionTitle = NSLocalizedString(@"Scheme Name", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   311
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   312
        case 1:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   313
            sectionTitle = NSLocalizedString(@"Game Settings", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   314
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   315
        case 2:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   316
            sectionTitle = NSLocalizedString(@"Game Modifiers", @"");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   317
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   318
        default:
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   319
            DLog(@"nope");
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   320
            break;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   321
    }
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   322
    return sectionTitle;
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   323
}
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   324
4113
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   325
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   326
    if ([indexPath section] == 2)
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   327
        return 56;
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   328
    else
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   329
        return self.tableView.rowHeight;
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   330
}
edb30dabf71a it locale for opendesktop
koda
parents: 4003
diff changeset
   331
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   332
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   333
#pragma mark Memory management
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   334
-(void) didReceiveMemoryWarning {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   335
    [super didReceiveMemoryWarning];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   336
    self.basicSettingList = nil;
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   337
    self.gameModifierArray = nil;
3547
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
-(void) viewDidUnload {
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   341
    self.schemeName = nil;
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   342
    self.schemeDictionary = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   343
    self.basicSettingList = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   344
    self.gameModifierArray = 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
   345
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   346
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   347
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   348
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   349
-(void) dealloc {
3659
f8d5ac50e307 half reworking of the settings page with delegation
koda
parents: 3643
diff changeset
   350
    [schemeName release];
3781
2bfda544ae48 modified file format for schemes files (which is going to introduce a lot of pre-release bugs, i'm sure)
koda
parents: 3753
diff changeset
   351
    [schemeDictionary release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   352
    [basicSettingList release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   353
    [gameModifierArray release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   354
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   355
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   356
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   357
@end