author | koda |
Sun, 28 Aug 2011 14:50:04 +0200 | |
changeset 5699 | 1a9a6a7662aa |
parent 5666 | cc79eb30346e |
child 5700 | f0960a88ab0e |
permissions | -rw-r--r-- |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
1 |
/* |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
2 |
* Hedgewars-iOS, a Hedgewars port for iOS devices |
4976 | 3 |
* Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com> |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
4 |
* |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
8 |
* |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
13 |
* |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
17 |
* |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
18 |
* File created on 22/09/2010. |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
19 |
*/ |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
20 |
|
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
21 |
|
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
22 |
#import "SavedGamesViewController.h" |
5156 | 23 |
#import "GameInterfaceBridge.h" |
3898 | 24 |
#import "CommodityFunctions.h" |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
25 |
|
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
26 |
@implementation SavedGamesViewController |
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
27 |
@synthesize tableView, listOfSavegames, interfaceBridge; |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
28 |
|
3898 | 29 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { |
30 |
return rotationManager(interfaceOrientation); |
|
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
31 |
} |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
32 |
|
3923
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
33 |
-(void) updateTable { |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
34 |
NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SAVES_DIRECTORY() error:NULL]; |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
35 |
NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES]; |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
36 |
self.listOfSavegames = array; |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
37 |
[array release]; |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
38 |
|
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
39 |
[self.tableView reloadData]; |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
40 |
} |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
41 |
|
3898 | 42 |
-(void) viewDidLoad { |
4115 | 43 |
if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) |
4082 | 44 |
self.tableView.backgroundView = nil; |
45 |
||
46 |
NSString *imgName; |
|
4030 | 47 |
if (IS_IPAD()) |
48 |
imgName = @"mediumBackground~ipad.png"; |
|
49 |
else |
|
50 |
imgName = @"smallerBackground~iphone.png"; |
|
51 |
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName]; |
|
52 |
self.view.backgroundColor = [UIColor colorWithPatternImage:img]; |
|
53 |
[img release]; |
|
4082 | 54 |
|
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
55 |
[super viewDidLoad]; |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
56 |
} |
3898 | 57 |
|
58 |
-(void) viewWillAppear:(BOOL)animated { |
|
3978 | 59 |
[self updateTable]; |
3898 | 60 |
[super viewWillAppear:animated]; |
61 |
} |
|
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
62 |
|
3923
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
63 |
#pragma mark - |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
64 |
#pragma mark button functions |
3898 | 65 |
-(IBAction) buttonPressed:(id) sender { |
66 |
playSound(@"backSound"); |
|
3903 | 67 |
[self.tableView setEditing:NO animated:YES]; |
3898 | 68 |
[[self parentViewController] dismissModalViewControllerAnimated:YES]; |
69 |
} |
|
70 |
||
3903 | 71 |
-(IBAction) toggleEdit:(id) sender { |
72 |
BOOL isEditing = self.tableView.editing; |
|
73 |
[self.tableView setEditing:!isEditing animated:YES]; |
|
3971 | 74 |
} |
75 |
||
76 |
-(void) duplicateEntry:(id) sender { |
|
77 |
UIButton *button = (UIButton *)sender; |
|
78 |
NSUInteger row = button.tag; |
|
79 |
||
80 |
if (self.listOfSavegames == nil) |
|
81 |
[self updateTable]; |
|
82 |
||
83 |
[(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil]; |
|
84 |
NSString *currentSaveName = [self.listOfSavegames objectAtIndex:row]; |
|
85 |
NSString *newSaveName = [[currentSaveName stringByDeletingPathExtension] stringByAppendingFormat:@" %d.hws",[self.listOfSavegames count]]; |
|
86 |
||
87 |
NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),currentSaveName]; |
|
88 |
NSString *newFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName]; |
|
89 |
[[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil]; |
|
90 |
[self.listOfSavegames addObject:newSaveName]; |
|
91 |
[self.listOfSavegames sortUsingSelector:@selector(compare:)]; |
|
92 |
||
93 |
[self.tableView reloadData]; |
|
3923
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
94 |
} |
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
95 |
|
694e6f6e0e30
various classes updates (new version in mainmenu, opt in mapconfig, clear all in savegames)
koda
parents:
3904
diff
changeset
|
96 |
-(IBAction) clearAll:(id) sender { |
3971 | 97 |
NSString *titleStr, *cancelStr, *confirmStr; |
3996 | 98 |
if (IS_IPAD()) { |
3971 | 99 |
titleStr = nil; |
100 |
cancelStr = nil; |
|
101 |
confirmStr = NSLocalizedString(@"Tap to confirm",@""); |
|
102 |
} else { |
|
103 |
titleStr = NSLocalizedString(@"Are you reeeeeally sure?", @""); |
|
104 |
cancelStr = NSLocalizedString(@"Well, maybe not...", @""); |
|
105 |
confirmStr = NSLocalizedString(@"Of course!", @""); |
|
106 |
} |
|
107 |
||
108 |
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleStr |
|
109 |
delegate:self |
|
110 |
cancelButtonTitle:cancelStr |
|
111 |
destructiveButtonTitle:confirmStr |
|
112 |
otherButtonTitles:nil]; |
|
4362
8dae325dc625
added missing graphics and fixed some glitches/crashes/bugs
koda
parents:
4115
diff
changeset
|
113 |
|
8dae325dc625
added missing graphics and fixed some glitches/crashes/bugs
koda
parents:
4115
diff
changeset
|
114 |
if (IS_IPAD()) |
8dae325dc625
added missing graphics and fixed some glitches/crashes/bugs
koda
parents:
4115
diff
changeset
|
115 |
[actionSheet showFromBarButtonItem:(UIBarButtonItem *)sender animated:YES]; |
8dae325dc625
added missing graphics and fixed some glitches/crashes/bugs
koda
parents:
4115
diff
changeset
|
116 |
else |
8dae325dc625
added missing graphics and fixed some glitches/crashes/bugs
koda
parents:
4115
diff
changeset
|
117 |
[actionSheet showInView:self.view]; |
3971 | 118 |
[actionSheet release]; |
119 |
} |
|
120 |
||
121 |
-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex { |
|
122 |
if ([actionSheet cancelButtonIndex] != buttonIndex) { |
|
123 |
[[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL]; |
|
124 |
[[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL]; |
|
125 |
[self updateTable]; |
|
126 |
} |
|
3903 | 127 |
} |
128 |
||
3898 | 129 |
#pragma mark - |
130 |
#pragma mark Table view data source |
|
131 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { |
|
132 |
return 1; |
|
133 |
} |
|
134 |
||
135 |
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
|
3971 | 136 |
if (self.listOfSavegames == nil) |
137 |
[self updateTable]; |
|
3898 | 138 |
return [self.listOfSavegames count]; |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
139 |
} |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
140 |
|
3898 | 141 |
-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
142 |
static NSString *CellIdentifier = @"Cell"; |
|
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
143 |
|
3971 | 144 |
if (self.listOfSavegames == nil) |
145 |
[self updateTable]; |
|
3903 | 146 |
EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; |
147 |
if (editableCell == nil) { |
|
148 |
editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
|
149 |
editableCell.delegate = self; |
|
150 |
} |
|
151 |
editableCell.tag = [indexPath row]; |
|
3904
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
152 |
editableCell.respectEditing = YES; |
3903 | 153 |
editableCell.textField.text = [[self.listOfSavegames objectAtIndex:[indexPath row]] stringByDeletingPathExtension]; |
154 |
editableCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; |
|
155 |
||
156 |
UIImage *addImg = [UIImage imageWithContentsOfFile:@"plus.png"]; |
|
157 |
UIButton *customButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; |
|
158 |
customButton.tag = [indexPath row]; |
|
159 |
[customButton setImage:addImg forState:UIControlStateNormal]; |
|
160 |
[customButton addTarget:self action:@selector(duplicateEntry:) forControlEvents:UIControlEventTouchUpInside]; |
|
161 |
editableCell.editingAccessoryView = customButton; |
|
162 |
||
163 |
return (UITableViewCell *)editableCell; |
|
164 |
} |
|
3904
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
165 |
|
3903 | 166 |
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section { |
3904
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
167 |
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 50)]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
168 |
footer.backgroundColor = [UIColor clearColor]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
169 |
|
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
170 |
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width*80/100, 100)]; |
4115 | 171 |
label.center = CGPointMake(self.tableView.frame.size.width/2, 70); |
3904
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
172 |
label.textAlignment = UITextAlignmentCenter; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
173 |
label.font = [UIFont systemFontOfSize:16]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
174 |
label.textColor = [UIColor lightGrayColor]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
175 |
label.numberOfLines = 5; |
4476
4bf74e158f44
team selection completely refactored, now has animation and more performance
koda
parents:
4362
diff
changeset
|
176 |
label.text = NSLocalizedString(@"Games are automatically saved and can be resumed by selecting an entry above.\nYou can modify this list by pressing the 'Edit' button.\nCompleted games are removed at the end of the match.",@""); |
3904
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
177 |
|
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
178 |
label.backgroundColor = [UIColor clearColor]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
179 |
[footer addSubview:label]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
180 |
[label release]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
181 |
return [footer autorelease]; |
22e4d74240e5
finishing touches to save games handling (help label, dim on overlay, edit text only when table is editable)
koda
parents:
3903
diff
changeset
|
182 |
} |
3898 | 183 |
|
4115 | 184 |
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { |
185 |
return 125; |
|
186 |
} |
|
187 |
||
3903 | 188 |
-(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { |
189 |
NSUInteger row = [indexPath row]; |
|
190 |
[(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil]; |
|
191 |
||
3971 | 192 |
if (self.listOfSavegames == nil) |
193 |
[self updateTable]; |
|
194 |
||
3903 | 195 |
NSString *saveName = [self.listOfSavegames objectAtIndex:row]; |
196 |
NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName]; |
|
197 |
[[NSFileManager defaultManager] removeItemAtPath:currentFilePath error:nil]; |
|
198 |
[self.listOfSavegames removeObject:saveName]; |
|
199 |
||
200 |
[self.tableView reloadData]; |
|
201 |
} |
|
3898 | 202 |
|
203 |
#pragma mark - |
|
204 |
#pragma mark Table view delegate |
|
205 |
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
|
206 |
[self.tableView deselectRowAtIndexPath:indexPath animated:YES]; |
|
3971 | 207 |
if (self.listOfSavegames == nil) |
208 |
[self updateTable]; |
|
209 |
||
3903 | 210 |
[(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil]; |
5156 | 211 |
|
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
212 |
if (self.interfaceBridge == nil) { |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
213 |
GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
214 |
self.interfaceBridge = bridge; |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
215 |
[bridge release]; |
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
216 |
} |
4763
c228a4841e3f
unify stats display on ipad and non-ipad and on saved and normal games
koda
parents:
4476
diff
changeset
|
217 |
|
5156 | 218 |
NSString *filePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]]; |
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
219 |
[self.interfaceBridge startSaveGame:filePath]; |
5156 | 220 |
[filePath release]; |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
221 |
} |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
222 |
|
3898 | 223 |
#pragma mark - |
3903 | 224 |
#pragma mark editableCellView delegate |
225 |
// rename old file if names differ |
|
226 |
-(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue { |
|
3971 | 227 |
if (self.listOfSavegames == nil) |
228 |
[self updateTable]; |
|
3903 | 229 |
NSString *oldFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:tagValue]]; |
230 |
NSString *newFilePath = [NSString stringWithFormat:@"%@/%@.hws",SAVES_DIRECTORY(),textString]; |
|
231 |
||
232 |
if ([oldFilePath isEqualToString:newFilePath] == NO) { |
|
233 |
[[NSFileManager defaultManager] moveItemAtPath:oldFilePath toPath:newFilePath error:nil]; |
|
234 |
[self.listOfSavegames replaceObjectAtIndex:tagValue withObject:[textString stringByAppendingString:@".hws"]]; |
|
235 |
} |
|
236 |
||
237 |
} |
|
238 |
||
239 |
#pragma mark - |
|
3898 | 240 |
#pragma mark Memory Management |
241 |
-(void) didReceiveMemoryWarning { |
|
3971 | 242 |
self.listOfSavegames = nil; |
5699
1a9a6a7662aa
ios: respond more gracefully to didReceiveMemoryWarning and add sounds to two buttons
koda
parents:
5666
diff
changeset
|
243 |
// don't nil this one or it won't be able to send messages |
1a9a6a7662aa
ios: respond more gracefully to didReceiveMemoryWarning and add sounds to two buttons
koda
parents:
5666
diff
changeset
|
244 |
//self.interfaceBridge = nil; |
3971 | 245 |
MSG_MEMCLEAN(); |
3898 | 246 |
[super didReceiveMemoryWarning]; |
247 |
} |
|
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
248 |
|
3898 | 249 |
-(void) viewDidUnload { |
250 |
self.tableView = nil; |
|
251 |
self.listOfSavegames = nil; |
|
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
252 |
self.interfaceBridge = nil; |
3971 | 253 |
MSG_DIDUNLOAD(); |
3898 | 254 |
[super viewDidUnload]; |
255 |
} |
|
256 |
||
257 |
-(void) dealloc { |
|
5208 | 258 |
releaseAndNil(tableView); |
259 |
releaseAndNil(listOfSavegames); |
|
5666
cc79eb30346e
this should fix the double free that happens when closing the sdl window on ios (untested)
koda
parents:
5208
diff
changeset
|
260 |
releaseAndNil(interfaceBridge); |
3893
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
261 |
[super dealloc]; |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
262 |
} |
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
263 |
|
568bfd083465
allow more flexibility between viewcontrollers, also added stub pages for saved games
koda
parents:
diff
changeset
|
264 |
@end |