# HG changeset patch # User koda # Date 1314535804 -7200 # Node ID 1a9a6a7662aa5e95d8c25bfd73e3df5221964ae6 # Parent 332b4cc985695a7a9581ba924bd5efd80c15e638 ios: respond more gracefully to didReceiveMemoryWarning and add sounds to two buttons diff -r 332b4cc98569 -r 1a9a6a7662aa project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sun Aug 28 11:50:26 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sun Aug 28 14:50:04 2011 +0200 @@ -378,7 +378,7 @@ self.mapConfigViewController = nil; self.imgContainer = nil; - self.interfaceBridge = nil; + //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; } diff -r 332b4cc98569 -r 1a9a6a7662aa project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m --- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Sun Aug 28 11:50:26 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Sun Aug 28 14:50:04 2011 +0200 @@ -65,7 +65,7 @@ AVAudioPlayer *background = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:musicString] error:nil]; background.delegate = nil; - background.volume = 0.5f; + background.volume = 0.4f; background.numberOfLoops = -1; [background prepareToPlay]; [HedgewarsAppDelegate sharedAppDelegate].backgroundMusic = background; @@ -126,7 +126,7 @@ // don't stop music when it is playing if (self.isInGame) { [self.backgroundMusic stop]; - releaseAndNil(self.backgroundMusic); + self.backgroundMusic = nil; MSG_MEMCLEAN(); } print_free_memory(); diff -r 332b4cc98569 -r 1a9a6a7662aa project_files/HedgewarsMobile/Classes/RestoreViewController.m --- a/project_files/HedgewarsMobile/Classes/RestoreViewController.m Sun Aug 28 11:50:26 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.m Sun Aug 28 14:50:04 2011 +0200 @@ -36,6 +36,7 @@ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if (theButton.tag != 0) { + playSound(@"clickSound"); if (self.interfaceBridge == nil) { GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self.parentViewController]; self.interfaceBridge = bridge; @@ -44,6 +45,7 @@ [self.parentViewController dismissModalViewControllerAnimated:NO]; [self.interfaceBridge startSaveGame:[defaults objectForKey:@"savedGamePath"]]; } else { + playSound(@"backSound"); [defaults setObject:@"" forKey:@"savedGamePath"]; [defaults synchronize]; [self.parentViewController dismissModalViewControllerAnimated:YES]; @@ -63,7 +65,8 @@ } -(void) didReceiveMemoryWarning { - self.interfaceBridge = nil; + // don't nil this one or it won't be able to send messages + //self.interfaceBridge = nil; [super didReceiveMemoryWarning]; } diff -r 332b4cc98569 -r 1a9a6a7662aa project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Sun Aug 28 11:50:26 2011 +0200 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Sun Aug 28 14:50:04 2011 +0200 @@ -240,7 +240,8 @@ #pragma mark Memory Management -(void) didReceiveMemoryWarning { self.listOfSavegames = nil; - self.interfaceBridge = nil; + // don't nil this one or it won't be able to send messages + //self.interfaceBridge = nil; MSG_MEMCLEAN(); [super didReceiveMemoryWarning]; }