18 * File created on 22/09/2010. |
18 * File created on 22/09/2010. |
19 */ |
19 */ |
20 |
20 |
21 |
21 |
22 #import "SavedGamesViewController.h" |
22 #import "SavedGamesViewController.h" |
23 #import "StatsPageViewController.h" |
23 #import "GameInterfaceBridge.h" |
24 #import "CommodityFunctions.h" |
24 #import "CommodityFunctions.h" |
25 |
25 |
26 @implementation SavedGamesViewController |
26 @implementation SavedGamesViewController |
27 @synthesize tableView, listOfSavegames; |
27 @synthesize tableView, listOfSavegames; |
28 |
28 |
206 [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; |
206 [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; |
207 if (self.listOfSavegames == nil) |
207 if (self.listOfSavegames == nil) |
208 [self updateTable]; |
208 [self updateTable]; |
209 |
209 |
210 [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil]; |
210 [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil]; |
211 |
211 |
212 NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]]; |
212 GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self]; |
213 |
213 |
214 NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys: |
214 NSString *filePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]]; |
215 filePath,@"savefile", |
215 [bridge startSaveGame:filePath]; |
216 [NSNumber numberWithBool:NO],@"netgame", |
216 [filePath release]; |
217 [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.interfaceOrientation] forKey:@"orientation"],@"game_dictionary", |
217 [bridge release]; |
218 nil]; |
218 /* // also modify GameConfigViewController.m |
219 |
|
220 // also modify GameConfigViewController.m |
|
221 StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
219 StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
222 statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
220 statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
223 if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) |
221 if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) |
224 statsPage.modalPresentationStyle = UIModalPresentationPageSheet; |
222 statsPage.modalPresentationStyle = UIModalPresentationPageSheet; |
225 // avoid showing the stat page immediately, but wait for 3 seconds |
223 // avoid showing the stat page immediately, but wait for 3 seconds |
239 [statsPage dismissModalViewControllerAnimated:NO]; |
237 [statsPage dismissModalViewControllerAnimated:NO]; |
240 } else { |
238 } else { |
241 statsPage.statsArray = stats; |
239 statsPage.statsArray = stats; |
242 [statsPage.tableView reloadData]; |
240 [statsPage.tableView reloadData]; |
243 [statsPage viewWillAppear:YES]; |
241 [statsPage viewWillAppear:YES]; |
244 } |
242 }*/ |
245 // reload needed because when ending game the entry remains there |
243 // reload needed because when ending game the entry remains there |
246 [self.tableView reloadData]; |
244 [self.tableView reloadData]; |
247 } |
245 } |
248 |
246 |
249 #pragma mark - |
247 #pragma mark - |