project_files/HedgewarsMobile/Classes/GameConfigViewController.m
changeset 5666 cc79eb30346e
parent 5455 df05cdb998ed
child 5699 1a9a6a7662aa
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Aug 23 09:23:45 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Aug 23 10:07:40 2011 +0200
@@ -30,7 +30,7 @@
 #import "PascalImports.h"
 
 @implementation GameConfigViewController
-@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController;
+@synthesize imgContainer, helpPage, mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController, interfaceBridge;
 
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
@@ -230,11 +230,12 @@
                                     script,@"mission_command",
                                     nil];
 
-    GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
-
-    [bridge startLocalGame:gameDictionary];
-
-    [bridge release];
+    if (self.interfaceBridge == nil) {
+        GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
+        self.interfaceBridge = bridge;
+        [bridge release];
+    }
+    [self.interfaceBridge startLocalGame:gameDictionary];
 }
 
 -(void) loadNiceHogs {
@@ -377,12 +378,14 @@
         self.mapConfigViewController = nil;
 
     self.imgContainer = nil;
+    self.interfaceBridge = nil;
     MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
     self.imgContainer = nil;
+    self.interfaceBridge = nil;
     self.mapConfigViewController = nil;
     self.teamConfigViewController = nil;
     self.schemeWeaponConfigViewController = nil;
@@ -393,6 +396,7 @@
 
 -(void) dealloc {
     releaseAndNil(imgContainer);
+    releaseAndNil(interfaceBridge);
     releaseAndNil(mapConfigViewController);
     releaseAndNil(teamConfigViewController);
     releaseAndNil(schemeWeaponConfigViewController);