minor stuff
authorkoda
Tue, 12 Oct 2010 05:06:30 +0200
changeset 3971 5c82ee165ed5
parent 3970 0f6e3219c108
child 3972 93212a97f01a
minor stuff
QTfrontend/hwconsts.cpp.in
hedgewars/GSHandlers.inc
hedgewars/hwengine.pas
hedgewars/uIO.pas
hedgewars/uKeys.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
project_files/HedgewarsMobile/Classes/AboutViewController.m
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/CommodityFunctions.m
project_files/HedgewarsMobile/Classes/FlagsViewController.m
project_files/HedgewarsMobile/Classes/FortsViewController.m
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
project_files/HedgewarsMobile/Classes/GravesViewController.m
project_files/HedgewarsMobile/Classes/HogHatViewController.m
project_files/HedgewarsMobile/Classes/InGameMenuViewController.m
project_files/HedgewarsMobile/Classes/LevelViewController.m
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/MapConfigViewController.m
project_files/HedgewarsMobile/Classes/MasterViewController.m
project_files/HedgewarsMobile/Classes/OverlayViewController.h
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h
project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m
project_files/HedgewarsMobile/Classes/SavedGamesViewController.h
project_files/HedgewarsMobile/Classes/SavedGamesViewController.m
project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib
project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
project_files/HedgewarsMobile/Classes/SplitViewRootController.m
project_files/HedgewarsMobile/Classes/TeamConfigViewController.m
project_files/HedgewarsMobile/Classes/VoicesViewController.m
--- a/QTfrontend/hwconsts.cpp.in	Mon Oct 11 16:56:00 2010 -0400
+++ b/QTfrontend/hwconsts.cpp.in	Tue Oct 12 05:06:30 2010 +0200
@@ -40,38 +40,43 @@
         "0405040541600655546554464776576666666155510101117"
         "0000000000000205500000040007004000000000200000000"
         "1311110312111111123114111111111111111211111101111"
-		);
+        );
 int cAmmoNumber = cDefaultAmmoStore->size() / 4;
 
 QList< QPair<QString, QString> > cDefaultAmmos =
-	QList< QPair<QString, QString> >()
-	<< qMakePair(QString("Default"), *cDefaultAmmoStore)
-	<< qMakePair(QString("Crazy"),     QString(
-        "9999999999999999992999999999999999299999999909999" // TODO: Remove Piano's unlimited uses!
+        QList< QPair<QString, QString> >()
+        << qMakePair(QString("Default"), *cDefaultAmmoStore)
+        << qMakePair(QString("Crazy"),     QString(
+        // TODO: Remove Piano's unlimited uses!
+        "9999999999999999992999999999999999299999999909999"
         "1111110111111111111111111111111111111111111101111"
         "0000000000000000000000000000000000000000000000000"
-        "1311110312111111123114111111111111111211110101111"))
-	<< qMakePair(QString("Pro mode"),  QString(
+        "1311110312111111123114111111111111111211110101111"
+        ))
+        << qMakePair(QString("Pro mode"),  QString(
         "9090009000000000000009000000000000000000000000000"
         "0000000000000000000000000000000000000000000000000"
         "0000000000000205500000040007004000000000200000000"
-        "1111111111111111111111111111111111111111100101111"))
-	<< qMakePair(QString("Shoppa"),    QString(
+        "1111111111111111111111111111111111111111100101111"
+        ))
+        << qMakePair(QString("Shoppa"),    QString(
         "0000009900000000000000000000000000000000000000000"
         "4444410044244402210112121222422000000002000400010"
         "0000000000000000000000000000000000000000000000000"
-        "1111111111111111111111111111111111111111101101111"))
-	<< qMakePair(QString("Basketball"),QString(
-		"0000009000000900000000000000000000000000000000000"
-		"0000000000000000000000000000000000000000000000000"
-		"0000000000000005500000040007004000000000200000000"
-		"1111111111111111111111111111111111111111111101111"))
-	<< qMakePair(QString("Minefield"), QString(
-		"0000009900090000000300000000000000000000000000000"
-		"0000000000000000000000000000000000000000000000000"
-		"0000000000000205500000040007004000000000200000000"
-		"1111111111111111111111111111111111111111111101111"))
-	;
+        "1111111111111111111111111111111111111111101101111"
+        ))
+        << qMakePair(QString("Basketball"),QString(
+        "0000009000000900000000000000000000000000000000000"
+        "0000000000000000000000000000000000000000000000000"
+        "0000000000000005500000040007004000000000200000000"
+        "1111111111111111111111111111111111111111111101111"
+        ))
+        << qMakePair(QString("Minefield"), QString(
+        "0000009900090000000300000000000000000000000000000"
+        "0000000000000000000000000000000000000000000000000"
+        "0000000000000205500000040007004000000000200000000"
+        "1111111111111111111111111111111111111111111101111"
+        ));
 
 QColor *colors[] = {
                     new QColor(221,   0,   0), // classic red
--- a/hedgewars/GSHandlers.inc	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/GSHandlers.inc	Tue Oct 12 05:06:30 2010 +0200
@@ -3342,7 +3342,7 @@
 var 
     iterator, conPortal: PGear;
     s, acptRadius, nx, ny, ox, oy, poffs, noffs, pspeed, nspeed: hwFloat;
-    noTrap, hasdxy: Boolean;
+    hasdxy: Boolean;
 begin
     doPortalColorSwitch();
 
--- a/hedgewars/hwengine.pas	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/hwengine.pas	Tue Oct 12 05:06:30 2010 +0200
@@ -36,8 +36,6 @@
     alsoShutdownFrontend: boolean = false;
 
 {$IFDEF HWLIBRARY}
-type arrayofpchar = array[0..10] of PChar;
-
 procedure initEverything(complete:boolean);
 procedure freeEverything(complete:boolean);
 
@@ -198,7 +196,7 @@
 
 ///////////////
 {$IFDEF HWLIBRARY}
-procedure Game(gameArgs: arrayofpchar); cdecl; export;
+procedure Game(gameArgs: PPChar); cdecl; export;
 {$ELSE}
 procedure Game;
 {$ENDIF}
@@ -216,7 +214,7 @@
 {$IFDEF DEBUGFILE}
     cShowFPS:= true;
 {$ELSE}
-    cShowFPS:= false;    // update me at release time
+    cShowFPS:= false;
 {$ENDIF}
     val(gameArgs[0], ipcPort);
     val(gameArgs[1], cScreenWidth);
--- a/hedgewars/uIO.pas	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/uIO.pas	Tue Oct 12 05:06:30 2010 +0200
@@ -237,7 +237,7 @@
 procedure SendIPCTimeInc;
 const timeinc: shortstring = '#';
 begin
-AddFileLog('Send #');
+{$IFDEF DEBUGFILE}AddFileLog('IPC Send #');{$ENDIF}
 SendIPCRaw(@timeinc, 2)
 end;
 
--- a/hedgewars/uKeys.pas	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/uKeys.pas	Tue Oct 12 05:06:30 2010 +0200
@@ -355,6 +355,7 @@
 procedure SetBinds(var binds: TBinds);
 begin
 {$IFDEF IPHONEOS}
+    binds:= binds; // avoid hint
     CurrentBinds:= DefaultBinds;
 {$ELSE}
     CurrentBinds:= binds;
--- a/hedgewars/uMisc.pas	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/uMisc.pas	Tue Oct 12 05:06:30 2010 +0200
@@ -189,7 +189,7 @@
 function  toPowerOf2(i: Longword): Longword; inline;
 function  DecodeBase64(s: shortstring): shortstring;
 function  doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
-function  endian(independent: LongWord): LongWord;
+function  endian(independent: LongWord): LongWord; inline;
 {$IFDEF DEBUGFILE}
 procedure AddFileLog(s: shortstring);
 (* function  RectToStr(Rect: TSDL_Rect): shortstring; *)
@@ -683,7 +683,7 @@
     exit(tmpsurf);
 end;
 
-function endian(independent: LongWord): LongWord;
+function endian(independent: LongWord): LongWord; inline;
 begin
 {$IFDEF ENDIAN_LITTLE}
 endian:= independent;
--- a/hedgewars/uStore.pas	Mon Oct 11 16:56:00 2010 -0400
+++ b/hedgewars/uStore.pas	Tue Oct 12 05:06:30 2010 +0200
@@ -1146,6 +1146,7 @@
 function glLoadExtension(extension : shortstring) : boolean;
 begin
 {$IFDEF IPHONEOS}
+    extension:= extension; // avoid hint
     glLoadExtension:= false;
 {$IFDEF DEBUGFILE}
     AddFileLog('OpenGL - "' + extension + '" skipped')
--- a/project_files/HedgewarsMobile/Classes/AboutViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/AboutViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -85,6 +85,7 @@
 #pragma mark -
 #pragma mark Memory Management
 -(void) didReceiveMemoryWarning {
+    self.people = nil;
     [super didReceiveMemoryWarning];
 }
 
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Tue Oct 12 05:06:30 2010 +0200
@@ -53,6 +53,8 @@
 
 #define IS_DUALHEAD()           ([[UIScreen screens] count] > 1)
 
+#define DEFAULT_NETGAME_PORT    46631
+
 
 void createTeamNamed (NSString *nameWithoutExt);
 void createWeaponNamed (NSString *nameWithoutExt, int type);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m	Tue Oct 12 05:06:30 2010 +0200
@@ -74,45 +74,45 @@
     switch (type) {
         case 0: //default
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"939192942219912103223511100120100000021111010101",@"ammostore_initialqt",
-                         @"040504054160065554655446477657666666615551010111",@"ammostore_probability",
-                         @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
-                         @"131111031211111112311411111111111111121111110111",@"ammostore_crate", nil];
+                         @"9391929422199121032235111001201000000211110101011",@"ammostore_initialqt",
+                         @"0405040541600655546554464776576666666155510101117",@"ammostore_probability",
+                         @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
+                         @"1311110312111111123114111111111111111211111101111",@"ammostore_crate", nil];
             break;
         case 1: //crazy
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"999999999999999999299999999999999929999999990999",@"ammostore_initialqt",
-                         @"111111011111111111111111111111111111111111110111",@"ammostore_probability",
-                         @"000000000000000000000000000000000000000000000000",@"ammostore_delay",
-                         @"131111031211111112311411111111111111121111010111",@"ammostore_crate", nil];
+                         @"9999999999999999992999999999999999299999999909999",@"ammostore_initialqt",
+                         @"1111110111111111111111111111111111111111111101111",@"ammostore_probability",
+                         @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
+                         @"1311110312111111123114111111111111111211110101111",@"ammostore_crate", nil];
             break;
         case 2: //pro mode
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"909000900000000000000900000000000000000000000000",@"ammostore_initialqt",
-                         @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
-                         @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
-                         @"111111111111111111111111111111111111111110010111",@"ammostore_crate", nil];
+                         @"9090009000000000000009000000000000000000000000000",@"ammostore_initialqt",
+                         @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
+                         @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
+                         @"1111111111111111111111111111111111111111100101111",@"ammostore_crate", nil];
             break;
         case 3: //shoppa
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"000000990000000000000000000000000000000000000000",@"ammostore_initialqt",
-                         @"444441004424440221011212122242200000000200040001",@"ammostore_probability",
-                         @"000000000000000000000000000000000000000000000000",@"ammostore_delay",
-                         @"111111111111111111111111111111111111111110110111",@"ammostore_crate", nil];
+                         @"0000009900000000000000000000000000000000000000000",@"ammostore_initialqt",
+                         @"4444410044244402210112121222422000000002000400010",@"ammostore_probability",
+                         @"0000000000000000000000000000000000000000000000000",@"ammostore_delay",
+                         @"1111111111111111111111111111111111111111101101111",@"ammostore_crate", nil];
             break;
         case 4: //basketball
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"939192942219912103223511100120100000021111010100",@"ammostore_initialqt",
-                         @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
-                         @"000000000000000550000004000700400000000020000000",@"ammostore_delay",
-                         @"111111111111111111111111111111111111111111110111",@"ammostore_crate", nil];
+                         @"9391929422199121032235111001201000000211110101000",@"ammostore_initialqt",
+                         @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
+                         @"0000000000000005500000040007004000000000200000000",@"ammostore_delay",
+                         @"1111111111111111111111111111111111111111111101111",@"ammostore_crate", nil];
             break;
         case 5: //minefield
             theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys:
-                         @"000000990009000000030000000000000000000000000000",@"ammostore_initialqt",
-                         @"000000000000000000000000000000000000000000000000",@"ammostore_probability",
-                         @"000000000000020550000004000700400000000020000000",@"ammostore_delay",
-                         @"111111111111111111111111111111111111111111110111",@"ammostore_crate", nil];
+                         @"0000009900090000000300000000000000000000000000000",@"ammostore_initialqt",
+                         @"0000000000000000000000000000000000000000000000000",@"ammostore_probability",
+                         @"0000000000000205500000040007004000000000200000000",@"ammostore_delay",
+                         @"1111111111111111111111111111111111111111111101111",@"ammostore_crate", nil];
             break;
         default:
             NSLog(@"Nope");
@@ -190,7 +190,8 @@
 
 NSInteger inline randomPort () {
     srandom(time(NULL));
-    return (random() % 64511) + 1024;
+    NSInteger res = (random() % 64511) + 1024;
+    return (res == DEFAULT_NETGAME_PORT) ? randomPort() : res;
 }
 
 void popError (const char *title, const char *message) {
--- a/project_files/HedgewarsMobile/Classes/FlagsViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -165,8 +165,6 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    // Relinquish ownership any cached data, images, etc that aren't in use.
     self.lastIndexPath = nil;
     MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
--- a/project_files/HedgewarsMobile/Classes/FortsViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/FortsViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -133,9 +133,9 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+    self.lastIndexPath = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -48,7 +48,7 @@
     switch (theButton.tag) {
         case 0:
             playSound(@"backSound");
-            if ([mapConfigViewController busy]) {
+            if ([self.mapConfigViewController busy]) {
                 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
                                                                 message:NSLocalizedString(@"Before returning the preview needs to be generated",@"")
                                                                delegate:nil
@@ -121,7 +121,7 @@
 
 -(BOOL) isEverythingSet {
     // don't start playing if the preview is in progress
-    if ([mapConfigViewController busy]) {
+    if ([self.mapConfigViewController busy]) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
                                                         message:NSLocalizedString(@"Before playing the preview needs to be generated",@"")
                                                        delegate:nil
@@ -133,7 +133,7 @@
     }
     
     // play only if there is more than one team
-    if ([teamConfigViewController.listOfSelectedTeams count] < 2) {
+    if ([self.teamConfigViewController.listOfSelectedTeams count] < 2) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"")
                                                         message:NSLocalizedString(@"Select at least two teams to play a game",@"")
                                                        delegate:nil
@@ -149,7 +149,7 @@
     for (NSDictionary *teamData in teamConfigViewController.listOfSelectedTeams)
         hogs += [[teamData objectForKey:@"number"] intValue];
     
-    if (hogs > mapConfigViewController.maxHogs) {
+    if (hogs > self.mapConfigViewController.maxHogs) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many hogs",@"")
                                                         message:NSLocalizedString(@"The map is too small for that many hogs",@"")
                                                        delegate:nil
@@ -160,7 +160,7 @@
         return NO;
     }
     
-    if ([teamConfigViewController.listOfSelectedTeams count] > HW_getMaxNumberOfTeams()) {
+    if ([self.teamConfigViewController.listOfSelectedTeams count] > HW_getMaxNumberOfTeams()) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too many teams",@"")
                                                         message:NSLocalizedString(@"Max six teams are allowed in the same game",@"")
                                                        delegate:nil
@@ -171,7 +171,7 @@
         return NO;
     }
     
-    if ([schemeWeaponConfigViewController.selectedScheme length] == 0 || [schemeWeaponConfigViewController.selectedWeapon length] == 0 ) {
+    if ([self.schemeWeaponConfigViewController.selectedScheme length] == 0 || [self.schemeWeaponConfigViewController.selectedWeapon length] == 0 ) {
         UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Missing detail",@"")
                                                         message:NSLocalizedString(@"Select one Scheme and one Weapon for this game",@"")
                                                        delegate:nil
@@ -192,19 +192,20 @@
         return;
 
     // create the configuration file that is going to be sent to engine
-    NSDictionary *gameDictionary = [NSDictionary dictionaryWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command",
-                                                                      mapConfigViewController.templateFilterCommand,@"templatefilter_command",
-                                                                      mapConfigViewController.mapGenCommand,@"mapgen_command",
-                                                                      mapConfigViewController.mazeSizeCommand,@"mazesize_command",
-                                                                      mapConfigViewController.themeCommand,@"theme_command",
-                                                                      mapConfigViewController.staticMapCommand,@"staticmap_command",
-                                                                      mapConfigViewController.missionCommand,@"mission_command",  
-                                                                      teamConfigViewController.listOfSelectedTeams,@"teams_list",
-                                                                      schemeWeaponConfigViewController.selectedScheme,@"scheme",
-                                                                      schemeWeaponConfigViewController.selectedWeapon,@"weapon",
-                                                                      [NSNumber numberWithInt:self.interfaceOrientation],@"orientation",
-                                                                      nil];
-
+    NSDictionary *gameDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
+                                    self.mapConfigViewController.seedCommand,@"seed_command",
+                                    self.mapConfigViewController.templateFilterCommand,@"templatefilter_command",
+                                    self.mapConfigViewController.mapGenCommand,@"mapgen_command",
+                                    self.mapConfigViewController.mazeSizeCommand,@"mazesize_command",
+                                    self.mapConfigViewController.themeCommand,@"theme_command",
+                                    self.mapConfigViewController.staticMapCommand,@"staticmap_command",
+                                    self.mapConfigViewController.missionCommand,@"mission_command",  
+                                    self.teamConfigViewController.listOfSelectedTeams,@"teams_list",
+                                    self.schemeWeaponConfigViewController.selectedScheme,@"scheme",
+                                    self.schemeWeaponConfigViewController.selectedWeapon,@"weapon",
+                                    [NSNumber numberWithInt:self.interfaceOrientation],@"orientation",
+                                    nil];
+    
     // finally launch game and remove this controller
     DLog(@"sending config %@", gameDictionary);
 
@@ -214,10 +215,10 @@
         [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
         
         // tell controllers that they're being reloaded
-        [mapConfigViewController viewWillAppear:YES];
+        [self.mapConfigViewController viewWillAppear:YES];
+        [self.schemeWeaponConfigViewController viewWillAppear:YES];
     } else {
-        DLog(@"gameconfig data not complete!!\nmapConfigViewController = %@\nteamConfigViewController = %@\nschemeWeaponConfigViewController = %@\n",
-             mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController);
+        DLog(@"gameconfig data not complete!!");
         [self.parentViewController dismissModalViewControllerAnimated:YES];
 
         // present an alert to the user, with an image on the ipad (too big for the iphone)
@@ -317,45 +318,44 @@
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
         [NSThread detachNewThreadSelector:@selector(loadNiceHogs) toTarget:self withObject:nil];
 
-    [mapConfigViewController viewWillAppear:animated];
-    [teamConfigViewController viewWillAppear:animated];
-    [schemeWeaponConfigViewController viewWillAppear:animated];
+    [self.mapConfigViewController viewWillAppear:animated];
+    [self.teamConfigViewController viewWillAppear:animated];
+    [self.schemeWeaponConfigViewController viewWillAppear:animated];
     // add other controllers here and below
 
     [super viewWillAppear:animated];
 }
 
 -(void) viewDidAppear:(BOOL)animated {
-    [mapConfigViewController viewDidAppear:animated];
-    [teamConfigViewController viewDidAppear:animated];
-    [schemeWeaponConfigViewController viewDidAppear:animated];
+    [self.mapConfigViewController viewDidAppear:animated];
+    [self.teamConfigViewController viewDidAppear:animated];
+    [self.schemeWeaponConfigViewController viewDidAppear:animated];
     [super viewDidAppear:animated];
 }
 
 -(void) viewWillDisappear:(BOOL)animated {
-    [mapConfigViewController viewWillDisappear:animated];
-    [teamConfigViewController viewWillDisappear:animated];
-    [schemeWeaponConfigViewController viewWillDisappear:animated];
+    [self.mapConfigViewController viewWillDisappear:animated];
+    [self.teamConfigViewController viewWillDisappear:animated];
+    [self.schemeWeaponConfigViewController viewWillDisappear:animated];
     [super viewWillDisappear:animated];
 }
 
 -(void) viewDidDisappear:(BOOL)animated {
-    [mapConfigViewController viewDidDisappear:animated];
-    [teamConfigViewController viewDidDisappear:animated];
-    [schemeWeaponConfigViewController viewDidDisappear:animated];
+    [self.mapConfigViewController viewDidDisappear:animated];
+    [self.teamConfigViewController viewDidDisappear:animated];
+    [self.schemeWeaponConfigViewController viewDidDisappear:animated];
     [super viewDidDisappear:animated];
 }
 
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    if (mapConfigViewController.view.superview == nil)
-        mapConfigViewController = nil;
-    if (teamConfigViewController.view.superview == nil)
-        teamConfigViewController = nil;
-    if (schemeWeaponConfigViewController.view.superview == nil)
-        schemeWeaponConfigViewController = nil;
-    if (helpPage.view.superview == nil)
-        helpPage = nil;
+    if (self.mapConfigViewController.view.superview == nil)
+        self.mapConfigViewController = nil;
+    if (self.teamConfigViewController.view.superview == nil)
+        self.teamConfigViewController = nil;
+    if (self.schemeWeaponConfigViewController.view.superview == nil)
+        self.schemeWeaponConfigViewController = nil;
+    if (self.helpPage.view.superview == nil)
+        self.helpPage = nil;
 
     // Release any cached data, images, etc that aren't in use.
     self.imgContainer = nil;
--- a/project_files/HedgewarsMobile/Classes/GravesViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/GravesViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -117,9 +117,9 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+    self.lastIndexPath = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/HogHatViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -33,7 +33,7 @@
 
 #pragma mark -
 #pragma mark View lifecycle
-- (void)viewDidLoad {
+-(void) viewDidLoad {
     [super viewDidLoad];
 
     // load all the hat file names and store them into hatArray
@@ -51,7 +51,7 @@
     self.title = NSLocalizedString(@"Change hedgehog's hat",@"");
 }
 
-- (void)viewWillAppear:(BOOL)animated {
+-(void) viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
 
     // this updates the hog name and its hat
@@ -72,7 +72,7 @@
 }
 
 // Customize the appearance of table view cells.
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
     static NSString *CellIdentifier = @"Cell";
 
@@ -103,7 +103,7 @@
 
 #pragma mark -
 #pragma mark Table view delegate
-- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+-(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     int newRow = [indexPath row];
     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
 
@@ -134,13 +134,13 @@
 
 #pragma mark -
 #pragma mark Memory management
-- (void)didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+-(void) didReceiveMemoryWarning {
+    self.lastIndexPath = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
-- (void)viewDidUnload {
+-(void) viewDidUnload {
     self.lastIndexPath = nil;
     self.normalHogSprite = nil;
     self.teamDictionary = nil;
@@ -149,7 +149,7 @@
     [super viewDidUnload];
 }
 
-- (void)dealloc {
+-(void) dealloc {
     [hatArray release];
     [teamDictionary release];
     [normalHogSprite release];
--- a/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/InGameMenuViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -35,7 +35,7 @@
 }
 
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+    self.menuList = nil;
     [super didReceiveMemoryWarning];
 }
 
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -184,9 +184,9 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+    self.lastIndexPath = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -35,16 +35,6 @@
     return rotationManager(interfaceOrientation);
 }
 
-- (void)didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
-    if (self.settingsViewController.view.superview == nil)
-        self.settingsViewController = nil;
-    if (self.gameConfigViewController.view.superview == nil)
-        self.gameConfigViewController = nil;
-    MSG_MEMCLEAN();
-}
-
 // using a different thread for audio 'cos it's slow
 -(void) initAudioThread {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -256,6 +246,19 @@
     [super viewDidUnload];
 }
 
+-(void) didReceiveMemoryWarning {
+    if (self.settingsViewController.view.superview == nil)
+        self.settingsViewController = nil;
+    if (self.gameConfigViewController.view.superview == nil)
+        self.gameConfigViewController = nil;
+    if (self.aboutViewController.view.superview == nil)
+        self.aboutViewController = nil;
+    if (self.savedGamesViewController.view.superview == nil)
+        self.savedGamesViewController = nil;
+    MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
+}
+
 -(void) dealloc {
     [settingsViewController release];
     [gameConfigViewController release];
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -466,11 +466,11 @@
 }
 
 -(void) didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
     self.dataSourceArray = nil;
     self.lastIndexPath = nil;
-    // maybe we can save some more
+
     MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
 }
 
 -(void) dealloc {
--- a/project_files/HedgewarsMobile/Classes/MasterViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/MasterViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -177,9 +177,6 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
     if (generalSettingsViewController.view.superview == nil)
         generalSettingsViewController = nil;
     if (teamSettingsViewController.view.superview == nil)
@@ -191,6 +188,7 @@
     if (supportViewController.view.superview == nil)
         supportViewController = nil;
     MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.h	Tue Oct 12 05:06:30 2010 +0200
@@ -31,7 +31,7 @@
     NSTimer *dimTimer;
 
     // the in-game menu
-    UIPopoverController *popoverController; // iPad only
+    UIPopoverController *popoverController; // iPad only, never set on iPhone
     InGameMenuViewController *popupMenu;
     BOOL isPopoverVisible;
 
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -210,16 +210,18 @@
 }
 
 -(void) didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
     if (self.popupMenu.view.superview == nil)
         self.popupMenu = nil;
     if (self.helpPage.view.superview == nil)
         self.helpPage = nil;
-    if (((UIPopoverController *)self.popoverController).contentViewController.view.superview == nil)
-        self.popoverController = nil;
     if (self.amvc.view.superview == nil)
         self.amvc = nil;
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+        if (((UIPopoverController *)self.popoverController).contentViewController.view.superview == nil)
+            self.popoverController = nil;
+    
     MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h	Tue Oct 12 05:06:30 2010 +0200
@@ -31,6 +31,7 @@
     BOOL isInGame;
 }
 
+@property (assign) BOOL isInGame;
 @property (nonatomic,retain) MainMenuViewController *mainViewController;
 @property (nonatomic,retain) UIWindow *uiwindow;
 @property (nonatomic,retain) UIWindow *secondWindow;
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Tue Oct 12 05:06:30 2010 +0200
@@ -58,7 +58,7 @@
 }
 
 @implementation SDLUIKitDelegate
-@synthesize mainViewController, uiwindow, secondWindow;
+@synthesize mainViewController, uiwindow, secondWindow, isInGame;
 
 // convenience method
 +(SDLUIKitDelegate *)sharedAppDelegate {
@@ -132,9 +132,9 @@
     [self performSelector:@selector(displayOverlayLater:) withObject:dict afterDelay:1];
 
     // this is the pascal fuction that starts the game (wrapped around isInGame)
-    isInGame = YES;
+    self.isInGame = YES;
     Game(gameArgs);
-    isInGame = NO;
+    self.isInGame = NO;
     free(gameArgs);
 
     [self.uiwindow makeKeyAndVisible];
@@ -204,7 +204,7 @@
 -(void) applicationWillTerminate:(UIApplication *)application {
     SDL_SendQuit();
 
-    if (isInGame) {
+    if (self.isInGame) {
         HW_terminate(YES);
         // hack to prevent automatic termination. See SDL_uikitevents.m for details
         longjmp(*(jump_env()), 1);
@@ -218,7 +218,7 @@
 }
 
 -(void) applicationWillResignActive:(UIApplication *)application {
-    if (isInGame) {
+    if (self.isInGame) {
         HW_pause();
 
         // Send every window on every screen a MINIMIZED event.
@@ -237,7 +237,7 @@
 }
 
 -(void) applicationDidBecomeActive:(UIApplication *)application {
-    if (isInGame) {
+    if (self.isInGame) {
         HW_pause();
 
         // Send every window on every screen a RESTORED event.
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Tue Oct 12 05:06:30 2010 +0200
@@ -22,7 +22,8 @@
 #import <UIKit/UIKit.h>
 #import "EditableCellView.h"
 
-@interface SavedGamesViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, EditableCellViewDelegate>  {
+@interface SavedGamesViewController : UIViewController <UITableViewDelegate, UITableViewDataSource,
+                                                        EditableCellViewDelegate, UIActionSheetDelegate>  {
     UITableView *tableView;
     NSMutableArray *listOfSavegames;
 }
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -64,16 +64,56 @@
 -(IBAction) toggleEdit:(id) sender {
     BOOL isEditing = self.tableView.editing;
     [self.tableView setEditing:!isEditing animated:YES];
-    UIToolbar *toolbar = (UIToolbar *)[self.view viewWithTag:458912];
-    for (UIBarButtonItem *item in toolbar.items)
-        if (item.tag == 452198)
-            item.enabled = !isEditing;
+}
+
+-(void) duplicateEntry:(id) sender {
+    UIButton *button = (UIButton *)sender;
+    NSUInteger row = button.tag;
+    
+    if (self.listOfSavegames == nil)
+        [self updateTable];
+    
+    [(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil];
+    NSString *currentSaveName = [self.listOfSavegames objectAtIndex:row];
+    NSString *newSaveName = [[currentSaveName stringByDeletingPathExtension] stringByAppendingFormat:@" %d.hws",[self.listOfSavegames count]];
+    
+    NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),currentSaveName];
+    NSString *newFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName];
+    [[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil];
+    [self.listOfSavegames addObject:newSaveName];
+    [self.listOfSavegames sortUsingSelector:@selector(compare:)];
+
+    //[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:[self.listOfSavegames indexOfObject:newSaveName] inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
+    [self.tableView reloadData];
 }
 
 -(IBAction) clearAll:(id) sender {
-    [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
-    [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
-    [self updateTable];
+    NSString *titleStr, *cancelStr, *confirmStr;
+    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+        titleStr = nil;
+        cancelStr = nil;
+        confirmStr = NSLocalizedString(@"Tap to confirm",@"");
+    } else {
+        titleStr = NSLocalizedString(@"Are you reeeeeally sure?", @"");
+        cancelStr = NSLocalizedString(@"Well, maybe not...", @"");
+        confirmStr = NSLocalizedString(@"Of course!", @"");
+    }
+
+    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:titleStr
+                                                             delegate:self
+                                                    cancelButtonTitle:cancelStr
+                                               destructiveButtonTitle:confirmStr
+                                                    otherButtonTitles:nil];
+    [actionSheet showInView:self.view];
+    [actionSheet release];
+}
+
+-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
+    if ([actionSheet cancelButtonIndex] != buttonIndex) {
+        [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
+        [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
+        [self updateTable];
+    }
 }
 
 #pragma mark -
@@ -83,12 +123,16 @@
 }
 
 -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    if (self.listOfSavegames == nil)
+        [self updateTable];
     return [self.listOfSavegames count];
 }
 
 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     static NSString *CellIdentifier = @"Cell";
 
+    if (self.listOfSavegames == nil)
+        [self updateTable];
     EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
     if (editableCell == nil) {
         editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
@@ -131,6 +175,9 @@
     NSUInteger row = [indexPath row];
     [(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil];
     
+    if (self.listOfSavegames == nil)
+        [self updateTable];
+    
     NSString *saveName = [self.listOfSavegames objectAtIndex:row];
     NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),saveName];
     [[NSFileManager defaultManager] removeItemAtPath:currentFilePath error:nil];
@@ -139,29 +186,13 @@
     [self.tableView reloadData];
 }
 
--(void) duplicateEntry:(id) sender {
-    UIButton *button = (UIButton *)sender;
-    NSUInteger row = button.tag;
-    
-    [(EditableCellView *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:0]] save:nil];
-    NSString *currentSaveName = [self.listOfSavegames objectAtIndex:row];
-    NSString *newSaveName = [[currentSaveName stringByDeletingPathExtension] stringByAppendingFormat:@" %d.hws",[self.listOfSavegames count]];
-    
-    NSString *currentFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),currentSaveName];
-    NSString *newFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName];
-    [[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil];
-    [self.listOfSavegames addObject:newSaveName];
-    [self.listOfSavegames sortUsingSelector:@selector(compare:)];
-
-    //[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:[self.listOfSavegames indexOfObject:newSaveName] inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
-    [self.tableView reloadData];
-}
-
 #pragma mark -
 #pragma mark Table view delegate
 -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
-    
+    if (self.listOfSavegames == nil)
+        [self updateTable];
+
     [(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil];
     
     NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]];
@@ -178,6 +209,8 @@
 #pragma mark editableCellView delegate
 // rename old file if names differ
 -(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+    if (self.listOfSavegames == nil)
+        [self updateTable];
     NSString *oldFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:tagValue]];
     NSString *newFilePath = [NSString stringWithFormat:@"%@/%@.hws",SAVES_DIRECTORY(),textString];
     
@@ -191,12 +224,15 @@
 #pragma mark -
 #pragma mark Memory Management
 -(void) didReceiveMemoryWarning {
+    self.listOfSavegames = nil;
+    MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
     self.tableView = nil;
     self.listOfSavegames = nil;
+    MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib	Tue Oct 12 05:06:30 2010 +0200
@@ -12,7 +12,7 @@
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="2"/>
+			<integer value="15"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -76,8 +76,6 @@
 								<int key="IBUISystemItemIdentifier">5</int>
 							</object>
 							<object class="IBUIBarButtonItem" id="882246004">
-								<int key="IBUITag">452198</int>
-								<bool key="IBUIEnabled">NO</bool>
 								<string key="IBUITitle">Clear All</string>
 								<string key="targetRuntimeIdentifier">IBIPadFramework</string>
 								<int key="IBUIStyle">1</int>
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -22,6 +22,7 @@
 #import "SchemeWeaponConfigViewController.h"
 #import <QuartzCore/QuartzCore.h>
 #import "CommodityFunctions.h"
+#import "SDL_uikitappdelegate.h"
 
 @implementation SchemeWeaponConfigViewController
 @synthesize listOfSchemes, listOfWeapons, lastIndexPath_sc, lastIndexPath_we, selectedScheme, selectedWeapon;
@@ -38,8 +39,8 @@
     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
 
-    self.selectedScheme = @"";
-    self.selectedWeapon = @"";
+    self.selectedScheme = nil;
+    self.selectedWeapon = nil;
 
     [self.tableView setBackgroundView:nil];
     self.view.backgroundColor = [UIColor clearColor];
@@ -53,13 +54,13 @@
     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
     self.listOfSchemes = contentsOfDir;
 
-    if ([self.selectedScheme isEqualToString:@""] && [listOfSchemes containsObject:@"Default.plist"])
+    if (self.selectedScheme == nil && [listOfSchemes containsObject:@"Default.plist"])
         self.selectedScheme = @"Default.plist";
     
     contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
     self.listOfWeapons = contentsOfDir;
     
-    if ([self.selectedWeapon isEqualToString:@""] && [listOfWeapons containsObject:@"Default.plist"])
+    if (self.selectedWeapon == nil && [listOfWeapons containsObject:@"Default.plist"])
         self.selectedWeapon = @"Default.plist";
     
     [self.tableView reloadData];
@@ -196,9 +197,14 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
+    if ([[SDLUIKitDelegate sharedAppDelegate] isInGame]) {
+        self.lastIndexPath_sc = nil;
+        self.lastIndexPath_we = nil;
+        self.listOfSchemes = nil;
+        self.listOfWeapons = nil;
+        MSG_MEMCLEAN();
+    }
     [super didReceiveMemoryWarning];
-    // Relinquish ownership any cached data, images, etc that aren't in use.
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/SplitViewRootController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/SplitViewRootController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -31,12 +31,10 @@
 }
 
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
-    // Release any cached data, images, etc that aren't in use.
     if (self.activeController.view.superview == nil)
         self.activeController = nil;
     MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
 }
 
 // load the view programmatically; we need a splitViewController that handles a MasterViewController
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -51,7 +51,7 @@
 
     NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
     // avoid overwriting selected teams when returning on this view
-    if ([cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
+    if ([self.cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
         NSArray *colors = getAvailableColors();
         NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[contentsOfDir count]];
         for (int i = 0; i < [contentsOfDir count]; i++) {
@@ -215,10 +215,10 @@
 #pragma mark -
 #pragma mark Memory management
 -(void) didReceiveMemoryWarning {
-    // Releases the view if it doesn't have a superview.
-    [super didReceiveMemoryWarning];
     // Relinquish ownership any cached data, images, etc that aren't in use.
     self.cachedContentsOfDir = nil;
+    MSG_MEMCLEAN();
+    [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Mon Oct 11 16:56:00 2010 -0400
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Tue Oct 12 05:06:30 2010 +0200
@@ -147,12 +147,17 @@
         Mix_FreeChunk(voiceBeingPlayed);
         voiceBeingPlayed = NULL;
     }
+    self.lastIndexPath = nil;
     MSG_MEMCLEAN();
     [super didReceiveMemoryWarning];
 }
 
 -(void) viewDidUnload {
-    voiceBeingPlayed = NULL;
+    if (voiceBeingPlayed != NULL) {
+        Mix_HaltChannel(lastChannel);
+        Mix_FreeChunk(voiceBeingPlayed);
+        voiceBeingPlayed = NULL;
+    }
     self.lastIndexPath = nil;
     self.teamDictionary = nil;
     self.voiceArray = nil;