project_files/HedgewarsMobile/Classes/MapConfigViewController.m
author koda
Mon, 18 Apr 2011 02:45:51 +0200
changeset 5156 641abe679bf0
parent 4976 088d40d8aba2
child 5207 4c9ae0f484da
permissions -rw-r--r--
work in progress yet again (can run some games now)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     1
/*
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4505
diff changeset
     3
 * Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
3829
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     4
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
81db3c85784b headers ftw, also right project file
koda
parents: 3792
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: 3792
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     8
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    12
 * GNU General Public License for more details.
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    13
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    14
 * You should have received a copy of the GNU General Public License
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    15
 * along with this program; if not, write to the Free Software
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    17
 *
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    18
 * File created on 22/04/2010.
81db3c85784b headers ftw, also right project file
koda
parents: 3792
diff changeset
    19
 */
81db3c85784b headers ftw, also right project file
koda
parents: 3792
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 "MapConfigViewController.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    23
#import "PascalImports.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"
4349
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
    26
#import "SchemeWeaponConfigViewController.h"
4362
8dae325dc625 added missing graphics and fixed some glitches/crashes/bugs
koda
parents: 4356
diff changeset
    27
#import "GameConfigViewController.h"
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    28
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    29
#define scIndex         self.segmentedControl.selectedSegmentIndex
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    30
#define isRandomness()  (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    31
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
@implementation MapConfigViewController
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
    33
@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand,
4362
8dae325dc625 added missing graphics and fixed some glitches/crashes/bugs
koda
parents: 4356
diff changeset
    34
            missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy,
8dae325dc625 added missing graphics and fixed some glitches/crashes/bugs
koda
parents: 4356
diff changeset
    35
            externalController, parentController;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
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
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    42
-(IBAction) mapButtonPressed {
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    43
    playSound(@"clickSound");
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    44
    [self updatePreview];
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    45
}
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    46
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
    47
-(void) updatePreview {
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    48
    // don't generate a new preview while it's already generating one
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    49
    if (busy)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    50
        return;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
    51
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    52
    // generate a seed
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    53
    CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    54
    NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    55
    CFRelease(uuid);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    56
    NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    57
    self.seedCommand = seedCmd;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    58
    [seedCmd release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
    59
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
    60
    if (self.dataSourceArray == nil)
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
    61
        [self loadDataSourceArray];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    62
    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
    NSIndexPath *theIndex;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    64
    if (isRandomness()) {
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    65
        // prevent other events and add an activity while the preview is beign generated
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    66
        [self turnOffWidgets];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    67
        [self.previewButton updatePreviewWithSeed:seed];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    68
        theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    69
    } else {
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
    70
        theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    71
        // the preview for static maps is loaded in didSelectRowAtIndexPath
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
    }
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    73
    [seed release];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    74
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    75
    // perform as if user clicked on an entry
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    76
    [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
4082
bfe14b38dad1 better support for wimpier i-devices
koda
parents: 3996
diff changeset
    77
    if (IS_NOT_POWERFUL() == NO)
4287
7dbdc862097c some interface tricks for iphone as well
koda
parents: 4244
diff changeset
    78
        [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    81
-(void) turnOffWidgets {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
    busy = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
    self.previewButton.alpha = 0.5f;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
    self.previewButton.enabled = NO;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
    self.maxLabel.text = @"...";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
    self.segmentedControl.enabled = NO;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
    self.slider.enabled = NO;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    88
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    89
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    90
-(void) turnOnWidgets {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    91
    self.previewButton.alpha = 1.0f;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    92
    self.previewButton.enabled = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    93
    self.segmentedControl.enabled = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    94
    self.slider.enabled = YES;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    95
    busy = NO;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    96
}
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
    97
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    98
-(void) setLabelText:(NSString *)str {
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
    99
    self.maxHogs = [str intValue];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   100
    self.maxLabel.text = str;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   101
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   102
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   103
-(NSDictionary *)getDataForEngine {
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   104
    NSDictionary *dictForEngine = [NSDictionary dictionaryWithObjectsAndKeys:
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   105
                                   self.seedCommand,@"seedCommand",
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   106
                                   self.templateFilterCommand,@"templateFilterCommand",
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   107
                                   self.mapGenCommand,@"mapGenCommand",
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   108
                                   self.mazeSizeCommand,@"mazeSizeCommand",
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   109
                                   nil];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   110
    return dictForEngine;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   111
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   112
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   113
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   114
#pragma mark Table view data source
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   115
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   116
    return 1;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   117
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   118
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   119
-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section {
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   120
    if (self.dataSourceArray == nil)
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   121
        [self loadDataSourceArray];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   122
    return [[self.dataSourceArray objectAtIndex:scIndex] count];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   123
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   125
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
    static NSString *CellIdentifier = @"Cell";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
    NSInteger row = [indexPath row];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   128
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   129
    UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   130
    if (cell == nil)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   131
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   132
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   133
    if (self.dataSourceArray == nil)
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   134
        [self loadDataSourceArray];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   135
    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   136
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   137
    NSString *labelString = [source objectAtIndex:row];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   138
    cell.textLabel.text = labelString;
3996
eb549fd864a5 the ios port is also iphone compatible
koda
parents: 3984
diff changeset
   139
    cell.textLabel.adjustsFontSizeToFitWidth = YES;
eb549fd864a5 the ios port is also iphone compatible
koda
parents: 3984
diff changeset
   140
    cell.textLabel.minimumFontSize = 7;
4244
bf46b4bdf27d iphone interface
koda
parents: 4115
diff changeset
   141
    cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
4476
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 4362
diff changeset
   142
    cell.textLabel.backgroundColor = [UIColor clearColor];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   143
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   144
    if (isRandomness()) {
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   145
        UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
        cell.imageView.image = image;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
        [image release];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   148
    } else
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
        cell.imageView.image = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   150
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   151
    if (row == [self.lastIndexPath row]) {
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   152
        UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   153
        cell.accessoryView = checkbox;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   154
        [checkbox release];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   155
    } else
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   156
        cell.accessoryView = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
4476
4bf74e158f44 team selection completely refactored, now has animation and more performance
koda
parents: 4362
diff changeset
   158
    cell.backgroundColor = UICOLOR_HW_ALMOSTBLACK;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
    return cell;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   160
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   162
// this set details for a static map (called by didSelectRowAtIndexPath)
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   163
-(void) setDetailsForStaticMap:(NSInteger) index {
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   164
    if (self.dataSourceArray == nil)
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   165
        [self loadDataSourceArray];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   166
    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   167
    
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   168
    NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", 
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   169
                         (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   170
    NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   171
    [fileCfg release];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   172
    NSArray *split = [contents componentsSeparatedByString:@"\n"];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   173
    [contents release];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   174
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   175
    // if the number is not set we keep 18 standard;
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   176
    // sometimes it's not set but there are trailing characters, we get around them with the second equation
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   177
    if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0)
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   178
        maxHogs = [[split objectAtIndex:1] intValue];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   179
    else
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   180
        maxHogs = 18;
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   181
    NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   182
    self.maxLabel.text = max;
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   183
    [max release];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   184
    
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   185
    self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   186
    self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [source objectAtIndex:index]];
3912
e11df2de6af2 have engine try for a second position when map loading fails (in this way it's possible to move Missions data to any path)
koda
parents: 3911
diff changeset
   187
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   188
    if (scIndex != 3)
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   189
        self.missionCommand = @"";
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   190
    else
3920
a54ca6185307 updated lua loading in the ifrontend and also fixed masked maps
koda
parents: 3912
diff changeset
   191
        self.missionCommand = [NSString stringWithFormat:@"escript Missions/Maps/%@/map.lua",[source objectAtIndex:index]];
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   192
}
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   193
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
#pragma mark -
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
#pragma mark Table view delegate
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
    int newRow = [indexPath row];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   198
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   199
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   200
    if (newRow != oldRow) {
3926
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   201
        if (self.dataSourceArray == nil)
668b71f31e51 use dynamic data from engine instead of using hardcoded values
koda
parents: 3920
diff changeset
   202
            [self loadDataSourceArray];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   203
        NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   204
        if (isRandomness()) {
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   205
            // just change the theme, don't update preview
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   206
            self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]];
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   207
        } else {
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   208
            NSString *fileImage = [NSString stringWithFormat:@"%@/%@/preview.png",
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   209
                                   (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:newRow]];
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   210
            [self.previewButton updatePreviewWithFile:fileImage];
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   211
            [self setDetailsForStaticMap:newRow];
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   212
        }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   213
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   214
        UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   215
        UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   216
        newCell.accessoryView = checkbox;
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   217
        [checkbox release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   218
        UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath];
3703
12d17c6e8855 halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents: 3697
diff changeset
   219
        oldCell.accessoryView = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   220
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   221
        self.lastIndexPath = indexPath;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   222
        [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   223
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   224
    [aTableView deselectRowAtIndexPath:indexPath animated:YES];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   225
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   226
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   227
#pragma mark -
4082
bfe14b38dad1 better support for wimpier i-devices
koda
parents: 3996
diff changeset
   228
#pragma mark slider & segmentedControl & button
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   229
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   230
// no methods are called by this routine and you can pass nil to it
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   231
-(IBAction) sliderChanged:(id) sender {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   232
    NSString *labelText;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   233
    NSString *templateCommand;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   234
    NSString *mazeCommand;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   235
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   236
    switch ((int)(self.slider.value*100)) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   237
        case 0:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   238
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   239
                labelText = NSLocalizedString(@"Wacky",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   240
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   241
                labelText = NSLocalizedString(@"Large Floating Islands",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   242
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   243
            templateCommand = @"e$template_filter 5";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   244
            mazeCommand = @"e$maze_size 5";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   245
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   246
        case 1:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   247
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   248
                labelText = NSLocalizedString(@"Cavern",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   249
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   250
                labelText = NSLocalizedString(@"Medium Floating Islands",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   251
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   252
            templateCommand = @"e$template_filter 4";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   253
            mazeCommand = @"e$maze_size 4";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   254
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   255
        case 2:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   256
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   257
                labelText = NSLocalizedString(@"Small",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   258
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   259
                labelText = NSLocalizedString(@"Small Floating Islands",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   260
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   261
            templateCommand = @"e$template_filter 1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   262
            mazeCommand = @"e$maze_size 3";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   263
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   264
        case 3:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   265
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   266
                labelText = NSLocalizedString(@"Medium",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   267
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   268
                labelText = NSLocalizedString(@"Large Tunnels",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   269
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   270
            templateCommand = @"e$template_filter 2";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   271
            mazeCommand = @"e$maze_size 2";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   272
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   273
        case 4:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   274
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   275
                labelText = NSLocalizedString(@"Large",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   276
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   277
                labelText = NSLocalizedString(@"Medium Tunnels",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   278
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   279
            templateCommand = @"e$template_filter 3";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   280
            mazeCommand = @"e$maze_size 1";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   281
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   282
        case 5:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   283
            if (self.segmentedControl.selectedSegmentIndex == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   284
                labelText = NSLocalizedString(@"All",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   285
            } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   286
                labelText = NSLocalizedString(@"Small Tunnels",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   287
            }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   288
            templateCommand = @"e$template_filter 0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   289
            mazeCommand = @"e$maze_size 0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   290
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   291
        default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   292
            labelText = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   293
            templateCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   294
            mazeCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   295
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   296
    }
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   297
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   298
    self.sizeLabel.text = labelText;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   299
    self.templateFilterCommand = templateCommand;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   300
    self.mazeSizeCommand = mazeCommand;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   301
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   302
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   303
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   304
-(IBAction) sliderEndedChanging:(id) sender {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   305
    int num = (int) (self.slider.value * 100);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   306
    if (oldValue != num) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   307
        [self updatePreview];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   308
        oldValue = num;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   309
    }
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
   310
    playSound(@"clickSound");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   311
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   312
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   313
// perform actions based on the activated section, then call updatePreview to visually update the selection
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   314
// and if necessary update the table with a slide animation
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   315
-(IBAction) segmentedControlChanged:(id) sender {
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   316
    NSString *mapgen, *staticmap, *mission;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   317
    NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   318
3783
8e9daf967406 X&Y buttons, sounds for some buttons, cleanup
koda
parents: 3780
diff changeset
   319
    playSound(@"selSound");
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   320
    switch (newPage) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   321
        case 0: // Random
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   322
            mapgen = @"e$mapgen 0";
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   323
            staticmap = @"";
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   324
            mission = @"";
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   325
            [self sliderChanged:nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   326
            self.slider.enabled = YES;
4349
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   327
            [externalController fillSections];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   328
            break;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   329
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   330
        case 1: // Map
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   331
            mapgen = @"e$mapgen 0";
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   332
            // dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   333
            staticmap = @"map Bamboo";
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   334
            mission = @"";
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   335
            self.slider.enabled = NO;
3791
98072b3871c1 help page for ingame, some other fixes here and there
koda
parents: 3789
diff changeset
   336
            self.sizeLabel.text = NSLocalizedString(@"No filter",@"");
4349
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   337
            [externalController fillSections];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   338
            break;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   339
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   340
        case 2: // Maze
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   341
            mapgen = @"e$mapgen 1";
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   342
            staticmap = @"";
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   343
            mission = @"";
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   344
            [self sliderChanged:nil];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   345
            self.slider.enabled = YES;
4349
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   346
            [externalController fillSections];
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   347
            break;
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   348
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   349
        case 3: // Mission
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   350
            mapgen = @"e$mapgen 0";
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   351
            // dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   352
            staticmap = @"map Bamboo";
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   353
            mission = @"";
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   354
            self.slider.enabled = NO;
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   355
            self.sizeLabel.text = NSLocalizedString(@"No filter",@"");
8efa91f98274 display an empty table for missions
koda
parents: 4290
diff changeset
   356
            [externalController emptySections];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   357
            break;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   358
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   359
        default:
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   360
            mapgen = nil;
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   361
            staticmap = nil;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   362
            mission = nil;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   363
            break;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   364
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   365
    self.mapGenCommand = mapgen;
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   366
    self.staticMapCommand = staticmap;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   367
    self.missionCommand = mission;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   368
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   369
    [self.tableView reloadData];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   370
    [self updatePreview];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   371
    oldPage = newPage;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   372
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   373
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   374
-(IBAction) buttonPressed:(id) sender {
4362
8dae325dc625 added missing graphics and fixed some glitches/crashes/bugs
koda
parents: 4356
diff changeset
   375
    [self.parentController buttonPressed:sender];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   376
}
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   377
4082
bfe14b38dad1 better support for wimpier i-devices
koda
parents: 3996
diff changeset
   378
#pragma mark -
bfe14b38dad1 better support for wimpier i-devices
koda
parents: 3996
diff changeset
   379
#pragma mark view management
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   380
-(void) loadDataSourceArray {
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   381
    // themes.cfg contains all the user-selectable themes
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   382
    NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   383
                                                       encoding:NSUTF8StringEncoding
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   384
                                                          error:NULL];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   385
    NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   386
    [string release];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   387
    // remove a trailing "" element
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   388
    [themeArray removeLastObject];
4505
4a8f87eb67cb disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents: 4476
diff changeset
   389
4a8f87eb67cb disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents: 4476
diff changeset
   390
    // remove images that are too big for certain devices without loading the whole image
4290
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   391
    NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   392
    NSMutableArray *mapArray = [[NSMutableArray alloc] init];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   393
    for (NSString *str in mapArrayFull) {
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   394
        CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   395
        if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   396
            continue;
4505
4a8f87eb67cb disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents: 4476
diff changeset
   397
        if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f)
4290
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   398
            continue;
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   399
        [mapArray addObject:str];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   400
    }
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   401
    
4290
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   402
    NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   403
    NSMutableArray *missionArray = [[NSMutableArray alloc] init];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   404
    for (NSString *str in missionArrayFull) {
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   405
        CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]);
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   406
        if (IS_NOT_POWERFUL() && imgSize.height > 1024.0f)
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   407
            continue;
4505
4a8f87eb67cb disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents: 4476
diff changeset
   408
        if (IS_NOT_VERY_POWERFUL() && imgSize.height > 1280.0f)
4290
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   409
            continue;
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   410
        [missionArray addObject:str];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   411
    }
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   412
    NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
4290
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   413
    [missionArray release];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   414
    [themeArray release];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   415
    [mapArray release];
82f1f1d819c0 don't list too big maps for certain devices
koda
parents: 4287
diff changeset
   416
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   417
    self.dataSourceArray = array;
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   418
    [array release];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   419
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   420
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   421
-(void) viewDidLoad {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   422
    [super viewDidLoad];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   423
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   424
    srandom(time(NULL));
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   425
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   426
    CGSize screenSize = [[UIScreen mainScreen] bounds].size;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   427
    self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   428
    
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   429
    // initialize some "default" values
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   430
    self.sizeLabel.text = NSLocalizedString(@"All",@"");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   431
    self.slider.value = 0.05f;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   432
    oldValue = 5;
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   433
    
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   434
    busy = NO;
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   435
    [self loadDataSourceArray];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   436
    self.lastIndexPath = [NSIndexPath indexPathForRow:-1 inSection:0];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   437
    
3789
c3eb56754e92 added a smaller version of forts, fixed a couple of regressions
koda
parents: 3783
diff changeset
   438
    // select a map at first because it's faster - done in IB
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   439
    oldPage = 1;
3791
98072b3871c1 help page for ingame, some other fixes here and there
koda
parents: 3789
diff changeset
   440
    if (self.segmentedControl.selectedSegmentIndex == 1) {
98072b3871c1 help page for ingame, some other fixes here and there
koda
parents: 3789
diff changeset
   441
        self.slider.enabled = NO;
98072b3871c1 help page for ingame, some other fixes here and there
koda
parents: 3789
diff changeset
   442
        self.sizeLabel.text = NSLocalizedString(@"No filter",@"");
98072b3871c1 help page for ingame, some other fixes here and there
koda
parents: 3789
diff changeset
   443
    }
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   444
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   445
    self.templateFilterCommand = @"e$template_filter 0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   446
    self.mazeSizeCommand = @"e$maze_size 0";
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   447
    self.mapGenCommand = @"e$mapgen 0";
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   448
    self.staticMapCommand = @"";
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   449
    self.missionCommand = @"";
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   450
4244
bf46b4bdf27d iphone interface
koda
parents: 4115
diff changeset
   451
    if ([self.tableView respondsToSelector:@selector(setBackgroundView:)])
bf46b4bdf27d iphone interface
koda
parents: 4115
diff changeset
   452
        [self.tableView setBackgroundView:nil];
4356
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   453
    self.tableView.backgroundColor = [UIColor clearColor];
4244
bf46b4bdf27d iphone interface
koda
parents: 4115
diff changeset
   454
    self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER;
bf46b4bdf27d iphone interface
koda
parents: 4115
diff changeset
   455
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   456
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   457
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   458
-(void) viewWillAppear:(BOOL)animated {
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   459
    if (self.dataSourceArray == nil)
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   460
        [self loadDataSourceArray];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   461
    [super viewWillAppear:animated];
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   462
}
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   463
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   464
-(void) viewDidAppear:(BOOL) animated {
3910
dd47efbdec46 move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents: 3829
diff changeset
   465
    [self updatePreview];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   466
    [super viewDidAppear:animated];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   467
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   468
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   469
-(void) viewDidUnload {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   470
    self.previewButton = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   471
    self.seedCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   472
    self.templateFilterCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   473
    self.mapGenCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   474
    self.mazeSizeCommand = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   475
    self.themeCommand = nil;
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   476
    self.staticMapCommand = nil;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   477
    self.missionCommand = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   478
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   479
    self.previewButton = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   480
    self.tableView = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   481
    self.maxLabel = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   482
    self.sizeLabel = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   483
    self.segmentedControl = nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   484
    self.slider = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   485
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   486
    self.lastIndexPath = nil;
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   487
    self.dataSourceArray = nil;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   488
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
   489
    MSG_DIDUNLOAD();
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   490
    [super viewDidUnload];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   491
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   492
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   493
-(void) didReceiveMemoryWarning {
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   494
    self.dataSourceArray = nil;
4356
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   495
    [super didReceiveMemoryWarning];
3984
d92509c2f255 some more memory opt
koda
parents: 3978
diff changeset
   496
4356
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   497
    if (self.view.superview == nil) {
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   498
        self.tableView = nil;
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   499
        self.maxLabel = nil;
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   500
        self.sizeLabel = nil;
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   501
        self.slider = nil;
d1d26f8963a3 update some files for new graphics and new ios4.2
koda
parents: 4349
diff changeset
   502
    }
3971
5c82ee165ed5 minor stuff
koda
parents: 3930
diff changeset
   503
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   504
    MSG_MEMCLEAN();
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   505
}
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   506
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   507
-(void) dealloc {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   508
    [seedCommand release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   509
    [templateFilterCommand release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   510
    [mapGenCommand release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   511
    [mazeSizeCommand release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   512
    [themeCommand release];
3642
fb39fecca350 support for static map added to iFrontend
koda
parents: 3625
diff changeset
   513
    [staticMapCommand release];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   514
    [missionCommand release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   515
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   516
    [previewButton release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   517
    [tableView release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   518
    [maxLabel release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   519
    [sizeLabel release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   520
    [segmentedControl release];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   521
    [slider release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   522
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   523
    [lastIndexPath release];
3911
46d7a5cf8ac6 further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents: 3910
diff changeset
   524
    [dataSourceArray release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3670
diff changeset
   525
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   526
    [super dealloc];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   527
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   528
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   529
@end