fix static land loading on desktop
authorkoda
Thu, 08 Jul 2010 23:06:21 +0200
changeset 3630 2c7a9d5aa18c
parent 3629 86212d2b116a
child 3631 159bc2fd7f68
fix static land loading on desktop add further checks to the sporadic init bug on iFoos
hedgewars/uLand.pas
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
--- a/hedgewars/uLand.pas	Thu Jul 08 02:23:10 2010 +0200
+++ b/hedgewars/uLand.pas	Thu Jul 08 23:06:21 2010 +0200
@@ -1208,8 +1208,9 @@
     LoadThemeConfig;
     isMap:= false;
     
-    if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then
-        FillChar(Land,SizeOf(TCollisionArray),0);
+    // is this not needed any more? let's hope setlength sets also 0s
+    //if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then
+    //    FillChar(Land,SizeOf(TCollisionArray),0);*)
         
     if (GameFlags and gfForts) = 0 then
         if Pathz[ptMapCurrent] <> '' then
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Thu Jul 08 02:23:10 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Thu Jul 08 23:06:21 2010 +0200
@@ -143,7 +143,7 @@
         return;
     }
     
-    // create the configuration file that is going to be sent to engine
+    /*
     NSDictionary *gameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:mapConfigViewController.seedCommand,@"seed_command",
                                                                       mapConfigViewController.templateFilterCommand,@"templatefilter_command",
                                                                       mapConfigViewController.mapGenCommand,@"mapgen_command",
@@ -153,13 +153,36 @@
                                                                       schemeWeaponConfigViewController.selectedScheme,@"scheme",
                                                                       schemeWeaponConfigViewController.selectedWeapon,@"weapon",
                                                                       nil];
-
+    */
+    
+    // create the configuration file that is going to be sent to engine
+    NSDictionary *gameDictionary = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:
+                                                                        mapConfigViewController.seedCommand,
+                                                                        mapConfigViewController.templateFilterCommand,
+                                                                        mapConfigViewController.mapGenCommand,
+                                                                        mapConfigViewController.mazeSizeCommand,
+                                                                        mapConfigViewController.themeCommand,
+                                                                        teamConfigViewController.listOfSelectedTeams,
+                                                                        schemeWeaponConfigViewController.selectedScheme,
+                                                                        schemeWeaponConfigViewController.selectedWeapon,nil]
+                                                               forKeys:[NSArray arrayWithObjects:
+                                                                        @"seed_command",
+                                                                        @"templatefilter_command",
+                                                                        @"mapgen_command",
+                                                                        @"mazesize_command",
+                                                                        @"theme_command",
+                                                                        @"teams_list",
+                                                                        @"scheme",
+                                                                        @"weapon",nil]];
     // finally launch game and remove this controller
     DLog(@"sending config %@", gameDictionary);
+    
+    if ([[gameDictionary allKeys] count] == 8) {
+        [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary];
+    } else {
+        DLog(@"gameconfig data not complete\n%@\nWHY???", gameDictionary);
+    }
 
-    [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary];
-    [gameDictionary release];
-    //[[self parentViewController] dismissModalViewControllerAnimated:YES];
 }
 
 -(void) viewDidLoad {