fix a crash in getting statistics and a glitch that made background music start while in-game
authorkoda
Sat, 24 Sep 2011 04:53:53 +0200
changeset 6008 215f0c9719e3
parent 6006 a211dcca5016
child 6009 14f6fc9869f2
fix a crash in getting statistics and a glitch that made background music start while in-game
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/RestoreViewController.m
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Sep 24 03:00:57 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sat Sep 24 04:53:53 2011 +0200
@@ -106,9 +106,6 @@
     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
     NSString *trackingVersion = [userDefaults stringForKey:@"HedgeVersion"];
 
-    if ([[userDefaults objectForKey:@"music"] boolValue])
-        [AudioManagerController playBackgroundMusic];
-
     if (trackingVersion == nil || [trackingVersion isEqualToString:version] == NO) {
         // remove any reminder of previous games as saves are going to be wiped out
         [userDefaults setObject:@"" forKey:@"savedGamePath"];
@@ -149,6 +146,10 @@
     */
 }
 
+-(void) viewWillAppear:(BOOL)animated {
+    [AudioManagerController playBackgroundMusic];
+    [super viewWillAppear:animated];
+}
 
 #pragma mark -
 -(IBAction) switchViews:(id) sender {
--- a/project_files/HedgewarsMobile/Classes/RestoreViewController.m	Sat Sep 24 03:00:57 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.m	Sat Sep 24 04:53:53 2011 +0200
@@ -42,8 +42,11 @@
             self.interfaceBridge = bridge;
             [bridge release];
         }
+        // TODO: it is useless to keep the modalcontroller around when calling interfacebridge
+        // but as long as it is an instance we mustn't release it beforehand
+        // moreover in this way the stats don't show up :/
+        [self.interfaceBridge startSaveGame:[defaults objectForKey:@"savedGamePath"]];
         [self.parentViewController dismissModalViewControllerAnimated:NO];
-        [self.interfaceBridge startSaveGame:[defaults objectForKey:@"savedGamePath"]];
     } else {
         [AudioManagerController playBackSound];
         [defaults setObject:@"" forKey:@"savedGamePath"];