author | koda |
Wed, 06 Oct 2010 02:31:04 +0200 | |
changeset 3926 | 668b71f31e51 |
parent 3920 | a54ca6185307 |
child 3930 | 8b00b4f93242 |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
3 |
* Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
17 |
* |
|
18 |
* File created on 22/04/2010. |
|
19 |
*/ |
|
20 |
||
3547 | 21 |
|
22 |
#import "MapConfigViewController.h" |
|
23 |
#import "PascalImports.h" |
|
24 |
#import "CommodityFunctions.h" |
|
25 |
#import "UIImageExtra.h" |
|
26 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
27 |
#define scIndex self.segmentedControl.selectedSegmentIndex |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
28 |
#define isRandomness() (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2) |
3547 | 29 |
|
30 |
@implementation MapConfigViewController |
|
3642 | 31 |
@synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand, |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
32 |
missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, delegate; |
3547 | 33 |
|
34 |
||
35 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
|
36 |
return rotationManager(interfaceOrientation); |
|
37 |
} |
|
38 |
||
3783 | 39 |
-(IBAction) mapButtonPressed { |
40 |
playSound(@"clickSound"); |
|
41 |
[self updatePreview]; |
|
42 |
} |
|
43 |
||
44 |
-(void) updatePreview { |
|
3547 | 45 |
// don't generate a new preview while it's already generating one |
46 |
if (busy) |
|
47 |
return; |
|
3697 | 48 |
|
3547 | 49 |
// generate a seed |
50 |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); |
|
51 |
NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); |
|
52 |
CFRelease(uuid); |
|
53 |
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
|
54 |
self.seedCommand = seedCmd; |
|
55 |
[seedCmd release]; |
|
3697 | 56 |
|
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
57 |
if (self.dataSourceArray == nil) |
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
58 |
[self loadDataSourceArray]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
59 |
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex]; |
3547 | 60 |
NSIndexPath *theIndex; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
61 |
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
|
62 |
// 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
|
63 |
[self turnOffWidgets]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
64 |
[self.previewButton updatePreviewWithSeed:seed]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
65 |
theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0]; |
3547 | 66 |
} else { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
67 |
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
|
68 |
// the preview for static maps is loaded in didSelectRowAtIndexPath |
3547 | 69 |
} |
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
70 |
[seed release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
71 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
72 |
// perform as if user clicked on an entry |
3547 | 73 |
[self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; |
74 |
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionNone animated:YES]; |
|
75 |
} |
|
76 |
||
77 |
-(void) turnOffWidgets { |
|
78 |
busy = YES; |
|
79 |
self.previewButton.alpha = 0.5f; |
|
80 |
self.previewButton.enabled = NO; |
|
81 |
self.maxLabel.text = @"..."; |
|
82 |
self.segmentedControl.enabled = NO; |
|
83 |
self.slider.enabled = NO; |
|
84 |
} |
|
85 |
||
86 |
-(void) turnOnWidgets { |
|
87 |
self.previewButton.alpha = 1.0f; |
|
88 |
self.previewButton.enabled = YES; |
|
89 |
self.segmentedControl.enabled = YES; |
|
90 |
self.slider.enabled = YES; |
|
91 |
busy = NO; |
|
92 |
} |
|
3697 | 93 |
|
3547 | 94 |
-(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
|
95 |
self.maxHogs = [str intValue]; |
3547 | 96 |
self.maxLabel.text = str; |
97 |
} |
|
98 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
99 |
-(NSDictionary *)getDataForEngine { |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
nil]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
106 |
return dictForEngine; |
3547 | 107 |
} |
108 |
||
109 |
#pragma mark - |
|
110 |
#pragma mark Table view data source |
|
111 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
112 |
return 1; |
|
113 |
} |
|
114 |
||
115 |
-(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section { |
|
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
116 |
if (self.dataSourceArray == nil) |
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
117 |
[self loadDataSourceArray]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
118 |
return [[self.dataSourceArray objectAtIndex:scIndex] count]; |
3547 | 119 |
} |
120 |
||
121 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
122 |
static NSString *CellIdentifier = @"Cell"; |
|
123 |
NSInteger row = [indexPath row]; |
|
3697 | 124 |
|
3547 | 125 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
3697 | 126 |
if (cell == nil) |
3547 | 127 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
3697 | 128 |
|
3792 | 129 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
130 |
cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; |
3697 | 131 |
|
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
132 |
if (self.dataSourceArray == nil) |
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
133 |
[self loadDataSourceArray]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
134 |
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
|
135 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
136 |
NSString *labelString = [source objectAtIndex:row]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
137 |
cell.textLabel.text = labelString; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
138 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
139 |
if (isRandomness()) { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
140 |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]]; |
3547 | 141 |
cell.imageView.image = image; |
142 |
[image release]; |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
143 |
} else |
3547 | 144 |
cell.imageView.image = nil; |
3697 | 145 |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
cell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
149 |
[checkbox release]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
150 |
} else |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
151 |
cell.accessoryView = nil; |
3547 | 152 |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
153 |
cell.backgroundColor = [UIColor blackColor]; |
3547 | 154 |
return cell; |
155 |
} |
|
156 |
||
3910
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
157 |
// 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
|
158 |
-(void) setDetailsForStaticMap:(NSInteger) index { |
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
159 |
if (self.dataSourceArray == nil) |
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
160 |
[self loadDataSourceArray]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
161 |
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
|
162 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
163 |
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
|
164 |
(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
|
165 |
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
|
166 |
[fileCfg release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
167 |
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
|
168 |
[contents release]; |
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
169 |
|
dd47efbdec46
move all preview drawing code into its own class (for a simplified and more readable MapConfigViewController)
koda
parents:
3829
diff
changeset
|
170 |
// 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
|
171 |
// 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
|
172 |
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
|
173 |
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
|
174 |
else |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
175 |
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
|
176 |
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
|
177 |
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
|
178 |
[max release]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
179 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
180 |
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
|
181 |
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
|
182 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
183 |
if (scIndex != 3) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
184 |
self.missionCommand = @""; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
185 |
else |
3920
a54ca6185307
updated lua loading in the ifrontend and also fixed masked maps
koda
parents:
3912
diff
changeset
|
186 |
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
|
187 |
} |
3547 | 188 |
|
189 |
#pragma mark - |
|
190 |
#pragma mark Table view delegate |
|
191 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
192 |
int newRow = [indexPath row]; |
|
193 |
int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
|
3697 | 194 |
|
3547 | 195 |
if (newRow != oldRow) { |
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
196 |
if (self.dataSourceArray == nil) |
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
197 |
[self loadDataSourceArray]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
198 |
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
|
199 |
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
|
200 |
// 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
|
201 |
self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]]; |
3642 | 202 |
} else { |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
203 |
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
|
204 |
(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
|
205 |
[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
|
206 |
[self setDetailsForStaticMap:newRow]; |
3642 | 207 |
} |
3697 | 208 |
|
209 |
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
|
210 |
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
|
211 |
newCell.accessoryView = checkbox; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
212 |
[checkbox release]; |
3547 | 213 |
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
|
214 |
oldCell.accessoryView = nil; |
3547 | 215 |
|
216 |
self.lastIndexPath = indexPath; |
|
217 |
[aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; |
|
218 |
} |
|
219 |
[aTableView deselectRowAtIndexPath:indexPath animated:YES]; |
|
220 |
} |
|
221 |
||
222 |
#pragma mark - |
|
223 |
#pragma mark slider & segmentedControl |
|
224 |
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl |
|
225 |
// no methods are called by this routine and you can pass nil to it |
|
226 |
-(IBAction) sliderChanged:(id) sender { |
|
227 |
NSString *labelText; |
|
228 |
NSString *templateCommand; |
|
229 |
NSString *mazeCommand; |
|
3697 | 230 |
|
3547 | 231 |
switch ((int)(self.slider.value*100)) { |
232 |
case 0: |
|
233 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
234 |
labelText = NSLocalizedString(@"Wacky",@""); |
|
235 |
} else { |
|
236 |
labelText = NSLocalizedString(@"Large Floating Islands",@""); |
|
237 |
} |
|
238 |
templateCommand = @"e$template_filter 5"; |
|
239 |
mazeCommand = @"e$maze_size 5"; |
|
240 |
break; |
|
241 |
case 1: |
|
242 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
243 |
labelText = NSLocalizedString(@"Cavern",@""); |
|
244 |
} else { |
|
245 |
labelText = NSLocalizedString(@"Medium Floating Islands",@""); |
|
246 |
} |
|
247 |
templateCommand = @"e$template_filter 4"; |
|
248 |
mazeCommand = @"e$maze_size 4"; |
|
249 |
break; |
|
250 |
case 2: |
|
251 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
252 |
labelText = NSLocalizedString(@"Small",@""); |
|
253 |
} else { |
|
254 |
labelText = NSLocalizedString(@"Small Floating Islands",@""); |
|
255 |
} |
|
256 |
templateCommand = @"e$template_filter 1"; |
|
257 |
mazeCommand = @"e$maze_size 3"; |
|
258 |
break; |
|
259 |
case 3: |
|
260 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
261 |
labelText = NSLocalizedString(@"Medium",@""); |
|
262 |
} else { |
|
263 |
labelText = NSLocalizedString(@"Large Tunnels",@""); |
|
264 |
} |
|
265 |
templateCommand = @"e$template_filter 2"; |
|
266 |
mazeCommand = @"e$maze_size 2"; |
|
267 |
break; |
|
268 |
case 4: |
|
269 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
270 |
labelText = NSLocalizedString(@"Large",@""); |
|
271 |
} else { |
|
272 |
labelText = NSLocalizedString(@"Medium Tunnels",@""); |
|
273 |
} |
|
274 |
templateCommand = @"e$template_filter 3"; |
|
275 |
mazeCommand = @"e$maze_size 1"; |
|
276 |
break; |
|
277 |
case 5: |
|
278 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
279 |
labelText = NSLocalizedString(@"All",@""); |
|
280 |
} else { |
|
281 |
labelText = NSLocalizedString(@"Small Tunnels",@""); |
|
282 |
} |
|
283 |
templateCommand = @"e$template_filter 0"; |
|
284 |
mazeCommand = @"e$maze_size 0"; |
|
285 |
break; |
|
286 |
default: |
|
287 |
labelText = nil; |
|
288 |
templateCommand = nil; |
|
289 |
mazeCommand = nil; |
|
290 |
break; |
|
291 |
} |
|
3697 | 292 |
|
3547 | 293 |
self.sizeLabel.text = labelText; |
294 |
self.templateFilterCommand = templateCommand; |
|
295 |
self.mazeSizeCommand = mazeCommand; |
|
296 |
} |
|
297 |
||
298 |
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up |
|
299 |
-(IBAction) sliderEndedChanging:(id) sender { |
|
300 |
int num = (int) (self.slider.value * 100); |
|
301 |
if (oldValue != num) { |
|
302 |
[self updatePreview]; |
|
303 |
oldValue = num; |
|
304 |
} |
|
3783 | 305 |
playSound(@"clickSound"); |
3547 | 306 |
} |
307 |
||
3697 | 308 |
// perform actions based on the activated section, then call updatePreview to visually update the selection |
3547 | 309 |
// and if necessary update the table with a slide animation |
310 |
-(IBAction) segmentedControlChanged:(id) sender { |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
311 |
NSString *mapgen, *staticmap, *mission; |
3547 | 312 |
NSInteger newPage = self.segmentedControl.selectedSegmentIndex; |
3697 | 313 |
|
3783 | 314 |
playSound(@"selSound"); |
3547 | 315 |
switch (newPage) { |
316 |
case 0: // Random |
|
317 |
mapgen = @"e$mapgen 0"; |
|
3642 | 318 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
319 |
mission = @""; |
3547 | 320 |
[self sliderChanged:nil]; |
321 |
self.slider.enabled = YES; |
|
322 |
break; |
|
3697 | 323 |
|
3547 | 324 |
case 1: // Map |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
325 |
case 3: // Mission |
3547 | 326 |
mapgen = @"e$mapgen 0"; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
327 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
3642 | 328 |
staticmap = @"map Bamboo"; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
329 |
mission = @""; |
3547 | 330 |
self.slider.enabled = NO; |
3791
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
331 |
self.sizeLabel.text = NSLocalizedString(@"No filter",@""); |
3547 | 332 |
break; |
3697 | 333 |
|
3547 | 334 |
case 2: // Maze |
335 |
mapgen = @"e$mapgen 1"; |
|
3642 | 336 |
staticmap = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
337 |
mission = @""; |
3547 | 338 |
[self sliderChanged:nil]; |
339 |
self.slider.enabled = YES; |
|
340 |
break; |
|
3697 | 341 |
|
3547 | 342 |
default: |
343 |
mapgen = nil; |
|
3642 | 344 |
staticmap = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
345 |
mission = nil; |
3547 | 346 |
break; |
347 |
} |
|
348 |
self.mapGenCommand = mapgen; |
|
3642 | 349 |
self.staticMapCommand = staticmap; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
350 |
self.missionCommand = mission; |
3697 | 351 |
|
3547 | 352 |
// nice animation for updating the table when appropriate (on iphone) |
353 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
354 |
if (((oldPage == 0 || oldPage == 2) && (newPage == 1 || newPage == 3)) || |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
355 |
((oldPage == 1 || oldPage == 3) && (newPage == 0 || newPage == 2)) || |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
356 |
((oldPage == 1 && newPage == 3) || (oldPage == 3 || newPage == 1))) { |
3547 | 357 |
self.tableView.frame = CGRectMake(480, 0, 185, 276); |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
358 |
[UIView beginAnimations:@"moving in table" context:NULL]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
359 |
self.tableView.frame = CGRectMake(295, 0, 185, 276); |
3547 | 360 |
[UIView commitAnimations]; |
361 |
} |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
362 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
363 |
[self.tableView reloadData]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
364 |
[self updatePreview]; |
3547 | 365 |
oldPage = newPage; |
366 |
} |
|
367 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
368 |
#pragma mark - |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
369 |
#pragma mark delegate functions for iPad |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
370 |
-(IBAction) buttonPressed:(id) sender { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
371 |
if (self.delegate != nil && [delegate respondsToSelector:@selector(buttonPressed:)]) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
372 |
[self.delegate buttonPressed:(UIButton *)sender]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
373 |
} |
3697 | 374 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
375 |
-(void) loadDataSourceArray { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
376 |
// 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
|
377 |
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
|
378 |
encoding:NSUTF8StringEncoding |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
379 |
error:NULL]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
380 |
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
|
381 |
[string release]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
382 |
// remove a trailing "" element |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
383 |
[themeArray removeLastObject]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
384 |
NSArray *mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
385 |
NSArray *missionArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
386 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
387 |
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
388 |
self.dataSourceArray = array; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
389 |
[array release]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
390 |
[themeArray release]; |
3547 | 391 |
} |
392 |
||
393 |
#pragma mark - |
|
394 |
#pragma mark view management |
|
395 |
-(void) viewDidLoad { |
|
396 |
[super viewDidLoad]; |
|
3697 | 397 |
|
3547 | 398 |
srandom(time(NULL)); |
3697 | 399 |
|
3547 | 400 |
CGSize screenSize = [[UIScreen mainScreen] bounds].size; |
401 |
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
|
402 |
|
3547 | 403 |
// initialize some "default" values |
404 |
self.sizeLabel.text = NSLocalizedString(@"All",@""); |
|
405 |
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
|
406 |
oldValue = 5; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
407 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
408 |
busy = NO; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
409 |
[self loadDataSourceArray]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
410 |
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
|
411 |
|
3789
c3eb56754e92
added a smaller version of forts, fixed a couple of regressions
koda
parents:
3783
diff
changeset
|
412 |
// 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
|
413 |
oldPage = 1; |
3791
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
414 |
if (self.segmentedControl.selectedSegmentIndex == 1) { |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
415 |
self.slider.enabled = NO; |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
416 |
self.sizeLabel.text = NSLocalizedString(@"No filter",@""); |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
417 |
} |
3547 | 418 |
|
419 |
self.templateFilterCommand = @"e$template_filter 0"; |
|
420 |
self.mazeSizeCommand = @"e$maze_size 0"; |
|
421 |
self.mapGenCommand = @"e$mapgen 0"; |
|
3642 | 422 |
self.staticMapCommand = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
423 |
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
|
424 |
|
3703
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
425 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
426 |
[self.tableView setBackgroundView:nil]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
427 |
self.view.backgroundColor = [UIColor clearColor]; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
428 |
self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
429 |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
430 |
self.tableView.rowHeight = 45; |
12d17c6e8855
halfway-through finishing the frontend with new graphics by Tiy + initial 'About' page set up
koda
parents:
3697
diff
changeset
|
431 |
} |
3547 | 432 |
} |
433 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
434 |
-(void) viewWillAppear:(BOOL)animated { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
435 |
if (self.dataSourceArray == nil) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
436 |
[self loadDataSourceArray]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
437 |
[super viewWillAppear:animated]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
438 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
439 |
|
3547 | 440 |
-(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
|
441 |
[self updatePreview]; |
3547 | 442 |
[super viewDidAppear:animated]; |
443 |
} |
|
444 |
||
445 |
-(void) viewDidUnload { |
|
3705 | 446 |
self.delegate = nil; |
447 |
||
3547 | 448 |
self.previewButton = nil; |
449 |
self.seedCommand = nil; |
|
450 |
self.templateFilterCommand = nil; |
|
451 |
self.mapGenCommand = nil; |
|
452 |
self.mazeSizeCommand = nil; |
|
453 |
self.themeCommand = nil; |
|
3642 | 454 |
self.staticMapCommand = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
455 |
self.missionCommand = nil; |
3697 | 456 |
|
3547 | 457 |
self.previewButton = nil; |
458 |
self.tableView = nil; |
|
459 |
self.maxLabel = nil; |
|
460 |
self.sizeLabel = nil; |
|
461 |
self.segmentedControl = nil; |
|
462 |
self.slider = nil; |
|
3697 | 463 |
|
3547 | 464 |
self.lastIndexPath = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
465 |
self.dataSourceArray = nil; |
3697 | 466 |
|
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
|
467 |
MSG_DIDUNLOAD(); |
3547 | 468 |
[super viewDidUnload]; |
469 |
} |
|
470 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
471 |
-(void) didReceiveMemoryWarning { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
472 |
[super didReceiveMemoryWarning]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
473 |
self.dataSourceArray = nil; |
3926
668b71f31e51
use dynamic data from engine instead of using hardcoded values
koda
parents:
3920
diff
changeset
|
474 |
self.lastIndexPath = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
475 |
// maybe we can save some more |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
476 |
MSG_MEMCLEAN(); |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
477 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
478 |
|
3547 | 479 |
-(void) dealloc { |
3705 | 480 |
self.delegate = nil; |
481 |
||
3547 | 482 |
[seedCommand release]; |
483 |
[templateFilterCommand release]; |
|
484 |
[mapGenCommand release]; |
|
485 |
[mazeSizeCommand release]; |
|
486 |
[themeCommand release]; |
|
3642 | 487 |
[staticMapCommand release]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
488 |
[missionCommand release]; |
3697 | 489 |
|
3547 | 490 |
[previewButton release]; |
491 |
[tableView release]; |
|
492 |
[maxLabel release]; |
|
493 |
[sizeLabel release]; |
|
494 |
[segmentedControl release]; |
|
495 |
[slider release]; |
|
3697 | 496 |
|
3547 | 497 |
[lastIndexPath release]; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
498 |
[dataSourceArray release]; |
3697 | 499 |
|
3547 | 500 |
[super dealloc]; |
501 |
} |
|
502 |
||
503 |
@end |