author | koda |
Sat, 24 Sep 2011 04:53:53 +0200 | |
changeset 6008 | 215f0c9719e3 |
parent 6000 | dbcebcd3d79f |
child 6078 | 8c0cc07731e5 |
permissions | -rw-r--r-- |
3829 | 1 |
/* |
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
|
4976 | 3 |
* Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com> |
3829 | 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" |
|
4349 | 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 | 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 | 31 |
|
32 |
@implementation MapConfigViewController |
|
3642 | 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 | 36 |
|
37 |
||
38 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
|
39 |
return rotationManager(interfaceOrientation); |
|
40 |
} |
|
41 |
||
3783 | 42 |
-(IBAction) mapButtonPressed { |
6000
dbcebcd3d79f
ios frontend: sounds and music have their own class now (with caching\!) instead of being spread here and there (exploiting class methods like a true oop pro)
koda
parents:
5483
diff
changeset
|
43 |
[AudioManagerController playClickSound]; |
3783 | 44 |
[self updatePreview]; |
45 |
} |
|
46 |
||
47 |
-(void) updatePreview { |
|
3547 | 48 |
// don't generate a new preview while it's already generating one |
49 |
if (busy) |
|
50 |
return; |
|
3697 | 51 |
|
3547 | 52 |
// generate a seed |
53 |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); |
|
54 |
NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); |
|
55 |
CFRelease(uuid); |
|
56 |
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed]; |
|
57 |
self.seedCommand = seedCmd; |
|
58 |
[seedCmd release]; |
|
3697 | 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 | 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 | 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 | 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 | 76 |
[self tableView:self.tableView didSelectRowAtIndexPath:theIndex]; |
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
77 |
if (IS_NOT_POWERFUL(getModelType()) == NO) |
4287 | 78 |
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES]; |
3547 | 79 |
} |
80 |
||
81 |
-(void) turnOffWidgets { |
|
82 |
busy = YES; |
|
83 |
self.previewButton.alpha = 0.5f; |
|
84 |
self.previewButton.enabled = NO; |
|
85 |
self.maxLabel.text = @"..."; |
|
86 |
self.segmentedControl.enabled = NO; |
|
87 |
self.slider.enabled = NO; |
|
88 |
} |
|
89 |
||
90 |
-(void) turnOnWidgets { |
|
91 |
self.previewButton.alpha = 1.0f; |
|
92 |
self.previewButton.enabled = YES; |
|
93 |
self.segmentedControl.enabled = YES; |
|
94 |
self.slider.enabled = YES; |
|
95 |
busy = NO; |
|
96 |
} |
|
3697 | 97 |
|
3547 | 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 | 100 |
self.maxLabel.text = str; |
101 |
} |
|
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 | 111 |
} |
112 |
||
113 |
#pragma mark - |
|
114 |
#pragma mark Table view data source |
|
115 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
116 |
return 1; |
|
117 |
} |
|
118 |
||
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 | 123 |
} |
124 |
||
125 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
|
126 |
static NSString *CellIdentifier = @"Cell"; |
|
127 |
NSInteger row = [indexPath row]; |
|
3697 | 128 |
|
3547 | 129 |
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
3697 | 130 |
if (cell == nil) |
3547 | 131 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
3697 | 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 | 139 |
cell.textLabel.adjustsFontSizeToFitWidth = YES; |
140 |
cell.textLabel.minimumFontSize = 7; |
|
4244 | 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 | 146 |
cell.imageView.image = image; |
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 | 149 |
cell.imageView.image = nil; |
3697 | 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 | 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 | 159 |
return cell; |
160 |
} |
|
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 | 193 |
|
194 |
#pragma mark - |
|
195 |
#pragma mark Table view delegate |
|
196 |
-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
197 |
int newRow = [indexPath row]; |
|
198 |
int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
|
3697 | 199 |
|
3547 | 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 | 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 | 212 |
} |
3697 | 213 |
|
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 | 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 | 220 |
|
221 |
self.lastIndexPath = indexPath; |
|
222 |
[aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone]; |
|
223 |
} |
|
224 |
[aTableView deselectRowAtIndexPath:indexPath animated:YES]; |
|
225 |
} |
|
226 |
||
227 |
#pragma mark - |
|
4082 | 228 |
#pragma mark slider & segmentedControl & button |
3547 | 229 |
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl |
230 |
// no methods are called by this routine and you can pass nil to it |
|
231 |
-(IBAction) sliderChanged:(id) sender { |
|
232 |
NSString *labelText; |
|
233 |
NSString *templateCommand; |
|
234 |
NSString *mazeCommand; |
|
3697 | 235 |
|
3547 | 236 |
switch ((int)(self.slider.value*100)) { |
237 |
case 0: |
|
238 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
239 |
labelText = NSLocalizedString(@"Wacky",@""); |
|
240 |
} else { |
|
241 |
labelText = NSLocalizedString(@"Large Floating Islands",@""); |
|
242 |
} |
|
243 |
templateCommand = @"e$template_filter 5"; |
|
244 |
mazeCommand = @"e$maze_size 5"; |
|
245 |
break; |
|
246 |
case 1: |
|
247 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
248 |
labelText = NSLocalizedString(@"Cavern",@""); |
|
249 |
} else { |
|
250 |
labelText = NSLocalizedString(@"Medium Floating Islands",@""); |
|
251 |
} |
|
252 |
templateCommand = @"e$template_filter 4"; |
|
253 |
mazeCommand = @"e$maze_size 4"; |
|
254 |
break; |
|
255 |
case 2: |
|
256 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
257 |
labelText = NSLocalizedString(@"Small",@""); |
|
258 |
} else { |
|
259 |
labelText = NSLocalizedString(@"Small Floating Islands",@""); |
|
260 |
} |
|
261 |
templateCommand = @"e$template_filter 1"; |
|
262 |
mazeCommand = @"e$maze_size 3"; |
|
263 |
break; |
|
264 |
case 3: |
|
265 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
266 |
labelText = NSLocalizedString(@"Medium",@""); |
|
267 |
} else { |
|
268 |
labelText = NSLocalizedString(@"Large Tunnels",@""); |
|
269 |
} |
|
270 |
templateCommand = @"e$template_filter 2"; |
|
271 |
mazeCommand = @"e$maze_size 2"; |
|
272 |
break; |
|
273 |
case 4: |
|
274 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
275 |
labelText = NSLocalizedString(@"Large",@""); |
|
276 |
} else { |
|
277 |
labelText = NSLocalizedString(@"Medium Tunnels",@""); |
|
278 |
} |
|
279 |
templateCommand = @"e$template_filter 3"; |
|
280 |
mazeCommand = @"e$maze_size 1"; |
|
281 |
break; |
|
282 |
case 5: |
|
283 |
if (self.segmentedControl.selectedSegmentIndex == 0) { |
|
284 |
labelText = NSLocalizedString(@"All",@""); |
|
285 |
} else { |
|
286 |
labelText = NSLocalizedString(@"Small Tunnels",@""); |
|
287 |
} |
|
288 |
templateCommand = @"e$template_filter 0"; |
|
289 |
mazeCommand = @"e$maze_size 0"; |
|
290 |
break; |
|
291 |
default: |
|
292 |
labelText = nil; |
|
293 |
templateCommand = nil; |
|
294 |
mazeCommand = nil; |
|
295 |
break; |
|
296 |
} |
|
3697 | 297 |
|
3547 | 298 |
self.sizeLabel.text = labelText; |
299 |
self.templateFilterCommand = templateCommand; |
|
300 |
self.mazeSizeCommand = mazeCommand; |
|
301 |
} |
|
302 |
||
303 |
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up |
|
304 |
-(IBAction) sliderEndedChanging:(id) sender { |
|
305 |
int num = (int) (self.slider.value * 100); |
|
306 |
if (oldValue != num) { |
|
307 |
[self updatePreview]; |
|
308 |
oldValue = num; |
|
309 |
} |
|
6000
dbcebcd3d79f
ios frontend: sounds and music have their own class now (with caching\!) instead of being spread here and there (exploiting class methods like a true oop pro)
koda
parents:
5483
diff
changeset
|
310 |
[AudioManagerController playClickSound]; |
3547 | 311 |
} |
312 |
||
3697 | 313 |
// perform actions based on the activated section, then call updatePreview to visually update the selection |
3547 | 314 |
// and if necessary update the table with a slide animation |
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 | 317 |
NSInteger newPage = self.segmentedControl.selectedSegmentIndex; |
3697 | 318 |
|
6000
dbcebcd3d79f
ios frontend: sounds and music have their own class now (with caching\!) instead of being spread here and there (exploiting class methods like a true oop pro)
koda
parents:
5483
diff
changeset
|
319 |
[AudioManagerController playSelectSound]; |
3547 | 320 |
switch (newPage) { |
321 |
case 0: // Random |
|
322 |
mapgen = @"e$mapgen 0"; |
|
3642 | 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 | 325 |
[self sliderChanged:nil]; |
326 |
self.slider.enabled = YES; |
|
4349 | 327 |
[externalController fillSections]; |
3547 | 328 |
break; |
3697 | 329 |
|
3547 | 330 |
case 1: // Map |
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 | 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 | 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 | 337 |
[externalController fillSections]; |
3547 | 338 |
break; |
3697 | 339 |
|
3547 | 340 |
case 2: // Maze |
341 |
mapgen = @"e$mapgen 1"; |
|
3642 | 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 | 344 |
[self sliderChanged:nil]; |
345 |
self.slider.enabled = YES; |
|
4349 | 346 |
[externalController fillSections]; |
347 |
break; |
|
348 |
||
349 |
case 3: // Mission |
|
350 |
mapgen = @"e$mapgen 0"; |
|
351 |
// dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap |
|
352 |
staticmap = @"map Bamboo"; |
|
353 |
mission = @""; |
|
354 |
self.slider.enabled = NO; |
|
355 |
self.sizeLabel.text = NSLocalizedString(@"No filter",@""); |
|
356 |
[externalController emptySections]; |
|
3547 | 357 |
break; |
3697 | 358 |
|
3547 | 359 |
default: |
360 |
mapgen = nil; |
|
3642 | 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 | 363 |
break; |
364 |
} |
|
365 |
self.mapGenCommand = mapgen; |
|
3642 | 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 | 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 | 371 |
oldPage = newPage; |
372 |
} |
|
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 | 377 |
|
4082 | 378 |
#pragma mark - |
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 { |
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
381 |
NSString *model = getModelType(); |
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
382 |
|
5281 | 383 |
// only folders containing icon.png are a valid theme |
384 |
NSArray *themeArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:THEMES_DIRECTORY() error:NULL]; |
|
385 |
NSMutableArray *themeArray = [[NSMutableArray alloc] init]; |
|
386 |
for (NSString *themeName in themeArrayFull) { |
|
387 |
NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]; |
|
388 |
if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath]) |
|
389 |
[themeArray addObject:themeName]; |
|
5483
fc755bb8096d
ios: caught some leaks, merged two methods inside a fuction, postponed the rating popup
koda
parents:
5281
diff
changeset
|
390 |
[checkPath release]; |
5281 | 391 |
} |
4505
4a8f87eb67cb
disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents:
4476
diff
changeset
|
392 |
|
4a8f87eb67cb
disable large maps also on iphone3gs and ipodtouch3g, they fail to load sometimes
koda
parents:
4476
diff
changeset
|
393 |
// remove images that are too big for certain devices without loading the whole image |
4290 | 394 |
NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL]; |
395 |
NSMutableArray *mapArray = [[NSMutableArray alloc] init]; |
|
396 |
for (NSString *str in mapArrayFull) { |
|
397 |
CGSize imgSize = PSPNGSizeFromMetaData([MAPS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
|
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
398 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
4290 | 399 |
continue; |
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
400 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
4290 | 401 |
continue; |
402 |
[mapArray addObject:str]; |
|
403 |
} |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
404 |
|
4290 | 405 |
NSArray *missionArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL]; |
406 |
NSMutableArray *missionArray = [[NSMutableArray alloc] init]; |
|
407 |
for (NSString *str in missionArrayFull) { |
|
408 |
CGSize imgSize = PSPNGSizeFromMetaData([MISSIONS_DIRECTORY() stringByAppendingFormat:@"%@/map.png",str]); |
|
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
409 |
if (IS_NOT_POWERFUL(model) && imgSize.height > 1024.0f) |
4290 | 410 |
continue; |
5207
4c9ae0f484da
some general tweaks (more intelligent use of macros and more caching)
koda
parents:
4976
diff
changeset
|
411 |
if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f) |
4290 | 412 |
continue; |
413 |
[missionArray addObject:str]; |
|
414 |
} |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
415 |
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil]; |
4290 | 416 |
[missionArray release]; |
417 |
[themeArray release]; |
|
418 |
[mapArray release]; |
|
419 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
420 |
self.dataSourceArray = array; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
421 |
[array release]; |
3547 | 422 |
} |
423 |
||
424 |
-(void) viewDidLoad { |
|
425 |
[super viewDidLoad]; |
|
3697 | 426 |
|
3547 | 427 |
srandom(time(NULL)); |
3697 | 428 |
|
3547 | 429 |
CGSize screenSize = [[UIScreen mainScreen] bounds].size; |
430 |
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
|
431 |
|
3547 | 432 |
// initialize some "default" values |
433 |
self.sizeLabel.text = NSLocalizedString(@"All",@""); |
|
434 |
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
|
435 |
oldValue = 5; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
436 |
|
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
437 |
busy = NO; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
438 |
[self loadDataSourceArray]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
439 |
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
|
440 |
|
3789
c3eb56754e92
added a smaller version of forts, fixed a couple of regressions
koda
parents:
3783
diff
changeset
|
441 |
// 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
|
442 |
oldPage = 1; |
3791
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
443 |
if (self.segmentedControl.selectedSegmentIndex == 1) { |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
444 |
self.slider.enabled = NO; |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
445 |
self.sizeLabel.text = NSLocalizedString(@"No filter",@""); |
98072b3871c1
help page for ingame, some other fixes here and there
koda
parents:
3789
diff
changeset
|
446 |
} |
3547 | 447 |
|
448 |
self.templateFilterCommand = @"e$template_filter 0"; |
|
449 |
self.mazeSizeCommand = @"e$maze_size 0"; |
|
450 |
self.mapGenCommand = @"e$mapgen 0"; |
|
3642 | 451 |
self.staticMapCommand = @""; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
452 |
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
|
453 |
|
4244 | 454 |
if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) |
455 |
[self.tableView setBackgroundView:nil]; |
|
4356 | 456 |
self.tableView.backgroundColor = [UIColor clearColor]; |
4244 | 457 |
self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; |
458 |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
|
3547 | 459 |
} |
460 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
461 |
-(void) viewWillAppear:(BOOL)animated { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
462 |
if (self.dataSourceArray == nil) |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
463 |
[self loadDataSourceArray]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
464 |
[super viewWillAppear:animated]; |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
465 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
466 |
|
3547 | 467 |
-(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
|
468 |
[self updatePreview]; |
3547 | 469 |
[super viewDidAppear:animated]; |
470 |
} |
|
471 |
||
472 |
-(void) viewDidUnload { |
|
473 |
self.previewButton = nil; |
|
474 |
self.seedCommand = nil; |
|
475 |
self.templateFilterCommand = nil; |
|
476 |
self.mapGenCommand = nil; |
|
477 |
self.mazeSizeCommand = nil; |
|
478 |
self.themeCommand = nil; |
|
3642 | 479 |
self.staticMapCommand = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
480 |
self.missionCommand = nil; |
3697 | 481 |
|
3547 | 482 |
self.previewButton = nil; |
483 |
self.tableView = nil; |
|
484 |
self.maxLabel = nil; |
|
485 |
self.sizeLabel = nil; |
|
486 |
self.segmentedControl = nil; |
|
487 |
self.slider = nil; |
|
3697 | 488 |
|
3547 | 489 |
self.lastIndexPath = nil; |
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
490 |
self.dataSourceArray = nil; |
3697 | 491 |
|
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
|
492 |
MSG_DIDUNLOAD(); |
3547 | 493 |
[super viewDidUnload]; |
494 |
} |
|
495 |
||
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
496 |
-(void) didReceiveMemoryWarning { |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
497 |
self.dataSourceArray = nil; |
4356 | 498 |
[super didReceiveMemoryWarning]; |
3984 | 499 |
|
4356 | 500 |
if (self.view.superview == nil) { |
501 |
self.tableView = nil; |
|
502 |
self.maxLabel = nil; |
|
503 |
self.sizeLabel = nil; |
|
504 |
self.slider = nil; |
|
505 |
} |
|
3971 | 506 |
|
3911
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
507 |
MSG_MEMCLEAN(); |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
508 |
} |
46d7a5cf8ac6
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
koda
parents:
3910
diff
changeset
|
509 |
|
3547 | 510 |
-(void) dealloc { |
5208 | 511 |
releaseAndNil(seedCommand); |
512 |
releaseAndNil(templateFilterCommand); |
|
513 |
releaseAndNil(mapGenCommand); |
|
514 |
releaseAndNil(mazeSizeCommand); |
|
515 |
releaseAndNil(themeCommand); |
|
516 |
releaseAndNil(staticMapCommand); |
|
517 |
releaseAndNil(missionCommand); |
|
3697 | 518 |
|
5208 | 519 |
releaseAndNil(previewButton); |
520 |
releaseAndNil(tableView); |
|
521 |
releaseAndNil(maxLabel); |
|
522 |
releaseAndNil(sizeLabel); |
|
523 |
releaseAndNil(segmentedControl); |
|
524 |
releaseAndNil(slider); |
|
3697 | 525 |
|
5208 | 526 |
releaseAndNil(lastIndexPath); |
527 |
releaseAndNil(dataSourceArray); |
|
3697 | 528 |
|
3547 | 529 |
[super dealloc]; |
530 |
} |
|
531 |
||
532 |
@end |