further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
authorkoda
Mon, 27 Sep 2010 01:51:12 +0200
changeset 3911 46d7a5cf8ac6
parent 3910 dd47efbdec46
child 3912 e11df2de6af2
further rework of MapConfigViewController, lists missions correctly (they don't load fine yet)
project_files/HedgewarsMobile/Classes/CommodityFunctions.h
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/MapConfigViewController.h
project_files/HedgewarsMobile/Classes/MapConfigViewController.m
project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib
project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Mon Sep 27 01:51:12 2010 +0200
@@ -21,7 +21,8 @@
 
 #import <Foundation/Foundation.h>
 
-#define MAX_HOGS 8
+#define MAX_HOGS                8
+#define CURRENT_AMMOSIZE        48      // also add a line in SingleWeaponViewController array
 
 #define DOCUMENTS_FOLDER()      [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
 
@@ -40,15 +41,14 @@
 #define BTN_DIRECTORY()         [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Btn"]
 #define FLAGS_DIRECTORY()       [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Flags/"]
 #define FORTS_DIRECTORY()       [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Forts/"]
+#define VOICES_DIRECTORY()      [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"]
 #define THEMES_DIRECTORY()      [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Themes/"]
 #define MAPS_DIRECTORY()        [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Maps/"]
-#define VOICES_DIRECTORY()      [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Sounds/voices/"]
+#define MISSIONS_DIRECTORY()    [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"]
 
 #define MSG_MEMCLEAN()          DLog(@"has cleaned up some memory");
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
 
-#define CURRENT_AMMOSIZE        48      // also add a line in SingleWeaponViewController array
-
 #define UICOLOR_HW_YELLOW_BODER [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xC0/255 blue:0 alpha:1]
 #define UICOLOR_HW_YELLOW_TEXT  [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1]
 #define UICOLOR_HW_DARKBLUE     [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1]
@@ -56,10 +56,10 @@
 void createTeamNamed (NSString *nameWithoutExt);
 void createWeaponNamed (NSString *nameWithoutExt, int type);
 void createSchemeNamed (NSString *nameWithoutExt);
-BOOL rotationManager (UIInterfaceOrientation interfaceOrientation);
-NSInteger randomPort ();
+void print_free_memory ();
+void playSound (NSString *snd);
 void popError (const char *title, const char *message);
-void print_free_memory ();
+BOOL rotationManager (UIInterfaceOrientation interfaceOrientation);
 BOOL isPhone ();
+NSInteger randomPort ();
 NSString *modelType ();
-void playSound (NSString *snd);
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Mon Sep 27 01:51:12 2010 +0200
@@ -183,6 +183,7 @@
                                                                       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",
@@ -191,10 +192,13 @@
     // finally launch game and remove this controller
     DLog(@"sending config %@", gameDictionary);
 
-    if ([[gameDictionary allKeys] count] == 9) {
+    if ([[gameDictionary allKeys] count] == 10) {
         NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:gameDictionary,@"game_dictionary", @"",@"savefile",
                                                                                     [NSNumber numberWithBool:NO],@"netgame", nil];
         [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
+        
+        // tell controllers that they're being reloaded
+        [mapConfigViewController viewWillAppear:YES];
     } else {
         DLog(@"gameconfig data not complete!!\nmapConfigViewController = %@\nteamConfigViewController = %@\nschemeWeaponConfigViewController = %@\n",
              mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController);
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Mon Sep 27 01:51:12 2010 +0200
@@ -338,7 +338,7 @@
                     [self sendToEngine:staticMap];
 
                 // lua script (if set)
-                NSString *script = [self.gameConfig objectForKey:@"script_command"];
+                NSString *script = [self.gameConfig objectForKey:@"mission_command"];
                 if ([script length] != 0)
                     [self sendToEngine:script];
                 
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h	Mon Sep 27 01:51:12 2010 +0200
@@ -44,6 +44,7 @@
     NSString *mazeSizeCommand;
     NSString *themeCommand;
     NSString *staticMapCommand;
+    NSString *missionCommand;
 
     // various widgets in the view
     MapPreviewButtonView *previewButton;
@@ -55,8 +56,7 @@
 
     // internal objects
     NSIndexPath *lastIndexPath;
-    NSArray *themeArray;
-    NSArray *mapArray;
+    NSArray *dataSourceArray;
 }
 
 @property (nonatomic,retain) id<MapConfigDelegate> delegate;
@@ -69,6 +69,7 @@
 @property (nonatomic,retain) NSString *mazeSizeCommand;
 @property (nonatomic,retain) NSString *themeCommand;
 @property (nonatomic,retain) NSString *staticMapCommand;
+@property (nonatomic,retain) NSString *missionCommand;
 
 @property (nonatomic,retain) IBOutlet MapPreviewButtonView *previewButton;
 @property (nonatomic,retain) IBOutlet UITableView *tableView;
@@ -78,8 +79,7 @@
 @property (nonatomic,retain) IBOutlet UISlider *slider;
 
 @property (nonatomic,retain) NSIndexPath *lastIndexPath;
-@property (nonatomic,retain) NSArray *themeArray;
-@property (nonatomic,retain) NSArray *mapArray;
+@property (nonatomic,retain) NSArray *dataSourceArray;
 
 -(IBAction) buttonPressed:(id) sender;
 
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m	Mon Sep 27 01:51:12 2010 +0200
@@ -24,10 +24,12 @@
 #import "CommodityFunctions.h"
 #import "UIImageExtra.h"
 
+#define scIndex         self.segmentedControl.selectedSegmentIndex
+#define isRandomness()  (segmentedControl.selectedSegmentIndex == 0 || segmentedControl.selectedSegmentIndex == 2)
 
 @implementation MapConfigViewController
 @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand,
-            tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, themeArray, mapArray, busy, delegate;
+            missionCommand, tableView, maxLabel, sizeLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy, delegate;
 
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
@@ -52,14 +54,15 @@
     self.seedCommand = seedCmd;
     [seedCmd release];
 
+    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
     NSIndexPath *theIndex;
-    if (segmentedControl.selectedSegmentIndex != 1) {
+    if (isRandomness()) {
         // prevent other events and add an activity while the preview is beign generated
         [self turnOffWidgets];
         [self.previewButton updatePreviewWithSeed:seed];
-        theIndex = [NSIndexPath indexPathForRow:(random()%[self.themeArray count]) inSection:0];
+        theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
     } else {
-        theIndex = [NSIndexPath indexPathForRow:(random()%[self.mapArray count]) inSection:0];
+        theIndex = [NSIndexPath indexPathForRow:(random()%[source count]) inSection:0];
         // the preview for static maps is loaded in didSelectRowAtIndexPath
     }
     [seed release];
@@ -108,10 +111,7 @@
 }
 
 -(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section {
-    if (self.segmentedControl.selectedSegmentIndex != 1)
-        return [themeArray count];
-    else
-        return [mapArray count];
+    return [[self.dataSourceArray objectAtIndex:scIndex] count];
 }
 
 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -125,17 +125,17 @@
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
         cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT;
 
-    if (self.segmentedControl.selectedSegmentIndex != 1) {
-        // the % prevents a strange bug that occurs sporadically
-        NSString *themeName = [self.themeArray objectAtIndex:row % [self.themeArray count]];
-        cell.textLabel.text = themeName;
-        UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName]];
+    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
+
+    NSString *labelString = [source objectAtIndex:row];
+    cell.textLabel.text = labelString;
+
+    if (isRandomness()) {
+        UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]];
         cell.imageView.image = image;
         [image release];
-    } else {
-        cell.textLabel.text = [self.mapArray objectAtIndex:row];
+    } else
         cell.imageView.image = nil;
-    }
 
     if (row == [self.lastIndexPath row]) {
         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
@@ -150,25 +150,31 @@
 
 // this set details for a static map (called by didSelectRowAtIndexPath)
 -(void) setDetailsForStaticMap:(NSInteger) index {
-    // update label
-    maxHogs = 18;
-    NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", MAPS_DIRECTORY(),[self.mapArray objectAtIndex:index]];
+    NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
+    
+    NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg", 
+                         (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
     NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
     [fileCfg release];
     NSArray *split = [contents componentsSeparatedByString:@"\n"];
     [contents release];
 
-    // set the theme and map here
-    self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]];
-    self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [self.mapArray objectAtIndex:index]];
-
     // if the number is not set we keep 18 standard;
     // sometimes it's not set but there are trailing characters, we get around them with the second equation
     if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0)
         maxHogs = [[split objectAtIndex:1] intValue];
+    else
+        maxHogs = 18;
     NSString *max = [[NSString alloc] initWithFormat:@"%d",maxHogs];
     self.maxLabel.text = max;
     [max release];
+    
+    self.themeCommand = [NSString stringWithFormat:@"etheme %@", [split objectAtIndex:0]];
+    self.staticMapCommand = [NSString stringWithFormat:@"emap %@", [source objectAtIndex:index]];
+    if (scIndex != 3)
+        self.missionCommand = @"";
+    else
+        self.missionCommand = [NSString stringWithFormat:@"escript %@/%@/map.lua",MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
 }
 
 #pragma mark -
@@ -178,12 +184,13 @@
     int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
 
     if (newRow != oldRow) {
-        [self.tableView reloadData];
-        if (self.segmentedControl.selectedSegmentIndex != 1) {
+        NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
+        if (isRandomness()) {
             // just change the theme, don't update preview
-            self.themeCommand = [NSString stringWithFormat:@"etheme %@", [self.themeArray objectAtIndex:newRow]];
+            self.themeCommand = [NSString stringWithFormat:@"etheme %@", [source objectAtIndex:newRow]];
         } else {
-            NSString *fileImage = [NSString stringWithFormat:@"%@/%@/preview.png",MAPS_DIRECTORY(),[self.mapArray objectAtIndex:newRow]];
+            NSString *fileImage = [NSString stringWithFormat:@"%@/%@/preview.png",
+                                   (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:newRow]];
             [self.previewButton updatePreviewWithFile:fileImage];
             [self setDetailsForStaticMap:newRow];
         }
@@ -290,7 +297,7 @@
 // perform actions based on the activated section, then call updatePreview to visually update the selection
 // and if necessary update the table with a slide animation
 -(IBAction) segmentedControlChanged:(id) sender {
-    NSString *mapgen, *staticmap;
+    NSString *mapgen, *staticmap, *mission;
     NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
 
     playSound(@"selSound");
@@ -298,14 +305,17 @@
         case 0: // Random
             mapgen = @"e$mapgen 0";
             staticmap = @"";
+            mission = @"";
             [self sliderChanged:nil];
             self.slider.enabled = YES;
             break;
 
         case 1: // Map
+        case 3: // Mission
             mapgen = @"e$mapgen 0";
-            // dummy value, everything is set by -updatePreview -> -didSelectRowAtIndexPath -> -updatePreviewWithMap
+            // dummy values, these are set by -updatePreview -> -didSelectRowAtIndexPath -> -setDetailsForStaticMap
             staticmap = @"map Bamboo";
+            mission = @"";
             self.slider.enabled = NO;
             self.sizeLabel.text = NSLocalizedString(@"No filter",@"");
             break;
@@ -313,6 +323,7 @@
         case 2: // Maze
             mapgen = @"e$mapgen 1";
             staticmap = @"";
+            mission = @"";
             [self sliderChanged:nil];
             self.slider.enabled = YES;
             break;
@@ -320,31 +331,52 @@
         default:
             mapgen = nil;
             staticmap = nil;
+            mission = nil;
             break;
     }
     self.mapGenCommand = mapgen;
     self.staticMapCommand = staticmap;
-    [self updatePreview];
+    self.missionCommand = mission;
 
     // nice animation for updating the table when appropriate (on iphone)
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
-        if (((oldPage == 0 || oldPage == 2) && newPage == 1) ||
-            (oldPage == 1 && (newPage == 0 || newPage == 2))) {
-            [UIView beginAnimations:@"moving out table" context:NULL];
+        if (((oldPage == 0 || oldPage == 2) && (newPage == 1 || newPage == 3)) ||
+            ((oldPage == 1 || oldPage == 3) && (newPage == 0 || newPage == 2)) ||
+            ((oldPage == 1 && newPage == 3) || (oldPage == 3 || newPage == 1))) {
             self.tableView.frame = CGRectMake(480, 0, 185, 276);
+            [UIView beginAnimations:@"moving in table" context:NULL];
+            self.tableView.frame = CGRectMake(295, 0, 185, 276);
             [UIView commitAnimations];
-            [self performSelector:@selector(moveTable) withObject:nil afterDelay:0.2];
         }
+
+    [self.tableView reloadData];
+    [self updatePreview];
     oldPage = newPage;
 }
 
-// update data when table is not visible and then show it
--(void) moveTable {
-    [self.tableView reloadData];
+#pragma mark -
+#pragma mark delegate functions for iPad
+-(IBAction) buttonPressed:(id) sender {
+    if (self.delegate != nil && [delegate respondsToSelector:@selector(buttonPressed:)])
+        [self.delegate buttonPressed:(UIButton *)sender];
+}
 
-    [UIView beginAnimations:@"moving in table" context:NULL];
-    self.tableView.frame = CGRectMake(295, 0, 185, 276);
-    [UIView commitAnimations];
+-(void) loadDataSourceArray {
+    // themes.cfg contains all the user-selectable themes
+    NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
+                                                       encoding:NSUTF8StringEncoding
+                                                          error:NULL];
+    NSMutableArray *themeArray = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]];
+    [string release];
+    // remove a trailing "" element
+    [themeArray removeLastObject];
+    NSArray *mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
+    NSArray *missionArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MISSIONS_DIRECTORY() error:NULL];
+    
+    NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
+    self.dataSourceArray = array;
+    [array release];
+    [themeArray release];
 }
 
 #pragma mark -
@@ -356,25 +388,18 @@
 
     CGSize screenSize = [[UIScreen mainScreen] bounds].size;
     self.view.frame = CGRectMake(0, 0, screenSize.height, screenSize.width - 44);
-
-    // themes.cfg contains all the user-selectable themes
-    NSString *string = [[NSString alloc] initWithContentsOfFile:[THEMES_DIRECTORY() stringByAppendingString:@"/themes.cfg"]
-                                                       encoding:NSUTF8StringEncoding
-                                                          error:NULL];
-    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[string componentsSeparatedByString:@"\n"]];
-    [string release];
-    // remove a trailing "" element
-    [array removeLastObject];
-    self.themeArray = array;
-    [array release];
-    self.mapArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
-
+    
     // initialize some "default" values
     self.sizeLabel.text = NSLocalizedString(@"All",@"");
     self.slider.value = 0.05f;
-
+    oldValue = 5;
+    
+    busy = NO;
+    [self loadDataSourceArray];
+    self.lastIndexPath = [NSIndexPath indexPathForRow:-1 inSection:0];
+    
     // select a map at first because it's faster - done in IB
-    //self.segmentedControl.selectedSegmentIndex = 1;
+    oldPage = 1;
     if (self.segmentedControl.selectedSegmentIndex == 1) {
         self.slider.enabled = NO;
         self.sizeLabel.text = NSLocalizedString(@"No filter",@"");
@@ -384,12 +409,7 @@
     self.mazeSizeCommand = @"e$maze_size 0";
     self.mapGenCommand = @"e$mapgen 0";
     self.staticMapCommand = @"";
-
-    self.lastIndexPath = [NSIndexPath indexPathForRow:-1 inSection:0];
-
-    oldValue = 5;
-    oldPage = 0;
-    busy = NO;
+    self.missionCommand = @"";
 
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
         [self.tableView setBackgroundView:nil];
@@ -400,24 +420,17 @@
     }
 }
 
+-(void) viewWillAppear:(BOOL)animated {
+    if (self.dataSourceArray == nil)
+        [self loadDataSourceArray];
+    [super viewWillAppear:animated];
+}
+
 -(void) viewDidAppear:(BOOL) animated {
     [self updatePreview];
     [super viewDidAppear:animated];
 }
 
-#pragma mark -
-#pragma mark delegate functions for iPad
--(IBAction) buttonPressed:(id) sender {
-    if (self.delegate != nil && [delegate respondsToSelector:@selector(buttonPressed:)])
-        [self.delegate buttonPressed:(UIButton *)sender];
-}
-
-#pragma mark -
--(void) didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    MSG_MEMCLEAN();
-}
-
 -(void) viewDidUnload {
     self.delegate = nil;
     
@@ -428,6 +441,7 @@
     self.mazeSizeCommand = nil;
     self.themeCommand = nil;
     self.staticMapCommand = nil;
+    self.missionCommand = nil;
 
     self.previewButton = nil;
     self.tableView = nil;
@@ -437,13 +451,19 @@
     self.slider = nil;
 
     self.lastIndexPath = nil;
-    self.themeArray = nil;
-    self.mapArray = nil;
+    self.dataSourceArray = nil;
 
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
 
+-(void) didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    self.dataSourceArray = nil;
+    // maybe we can save some more
+    MSG_MEMCLEAN();
+}
+
 -(void) dealloc {
     self.delegate = nil;
     
@@ -453,6 +473,7 @@
     [mazeSizeCommand release];
     [themeCommand release];
     [staticMapCommand release];
+    [missionCommand release];
 
     [previewButton release];
     [tableView release];
@@ -462,8 +483,7 @@
     [slider release];
 
     [lastIndexPath release];
-    [themeArray release];
-    [mapArray release];
+    [dataSourceArray release];
 
     [super dealloc];
 }
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Mon Sep 27 01:51:12 2010 +0200
@@ -2144,7 +2144,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Hats/{TeamCap,TeamHeadband,TeamHair}\n\ncp -R ${PROJECT_DIR}/audio/* ${PROJECT_DIR}/Data/\n\n#the following ones must be removed when their support is implemented\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\n\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball} ${PROJECT_DIR}/Data/Missions/Maps/\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\n#remove Isalnd from the list of Themes\nawk '{if ($1 != \"Island\") print $0}' < ${PROJECT_DIR}/Data/Themes/themes.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/themes.cfg\n\n#remove Isalnd from the Maps and themes\nrm -rf ${PROJECT_DIR}/Data/Themes/Island\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/Cave/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/Cave/map.cfg\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/Lonely_Island/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/Lonely_Island/map.cfg\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/PirateFlag/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/PirateFlag/map.cfg\n\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n\n#delete useless fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n";
+			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\nmkdir ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/btn*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp ${PROJECT_DIR}/../../QTfrontend/res/ammopic.png ${PROJECT_DIR}/Data/Graphics/Btn/iconAmmo.png\ncp ${PROJECT_DIR}/../../QTfrontend/res/icon*.png ${PROJECT_DIR}/Data/Graphics/Btn\ncp -R ${PROJECT_DIR}/../../QTfrontend/res/botlevels ${PROJECT_DIR}/Data/Graphics/Hedgehog/botlevels\n\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\n\n#delete desktop frontend translation\nrm -rf ${PROJECT_DIR}/Data/Locale/hedgewars_*\n\n#delete dummy maps and hats\nrm -rf ${PROJECT_DIR}/Data/Maps/{test*,Ruler}\nrm -rf ${PROJECT_DIR}/Data/Hats/{TeamCap,TeamHeadband,TeamHair}\n\n#copy mono audio\ncp -R ${PROJECT_DIR}/audio/* ${PROJECT_DIR}/Data/\n\n#the following ones must be removed when their support is implemented\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\n\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nmv ${PROJECT_DIR}/Data/Maps/{Basketball,Knockball} ${PROJECT_DIR}/Data/Missions/Maps/\n\n#reduce the number of flakes for City\nawk '{if ($1 == 1500) $1=40; print $0}' < ${PROJECT_DIR}/Data/Themes/City/theme.cfg > /tmp/tempfile\nmv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\n#remove Isalnd from the list of Themes\nawk '{if ($1 != \"Island\") print $0}' < ${PROJECT_DIR}/Data/Themes/themes.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Themes/themes.cfg\n\n#remove Isalnd from the Maps and themes\nrm -rf ${PROJECT_DIR}/Data/Themes/Island\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/Cave/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/Cave/map.cfg\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/Lonely_Island/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/Lonely_Island/map.cfg\nawk '{if ($1 == \"Island\") print \"Nature\"}' < ${PROJECT_DIR}/Data/Maps/PirateFlag/map.cfg > /tmp/tempfile && mv /tmp/tempfile ${PROJECT_DIR}/Data/Maps/PirateFlag/map.cfg\n\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n\n#delete useless fonts\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\n#delete all names, reserved hats\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\n";
 			showEnvVarsInLog = 0;
 		};
 		9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
--- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPad.xib	Mon Sep 27 01:51:12 2010 +0200
@@ -148,42 +148,47 @@
 					<object class="IBUISegmentedControl" id="88728219">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">289</int>
-						<string key="NSFrame">{{744, 166}, {240, 30}}</string>
+						<string key="NSFrame">{{725, 166}, {277, 30}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
 						<int key="IBSegmentControlStyle">2</int>
-						<int key="IBNumberOfSegments">3</int>
+						<int key="IBNumberOfSegments">4</int>
 						<int key="IBSelectedSegmentIndex">1</int>
 						<object class="NSArray" key="IBSegmentTitles">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>Random</string>
 							<string>Map</string>
 							<string>Maze</string>
+							<string>Mission</string>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentWidths">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<real value="0.0"/>
 							<real value="0.0"/>
 							<real value="0.0"/>
+							<real value="0.0"/>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentEnabledStates">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<boolean value="YES"/>
 							<boolean value="YES"/>
 							<boolean value="YES"/>
+							<boolean value="YES"/>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentContentOffsets">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>{0, 0}</string>
 							<string>{0, 0}</string>
 							<string>{0, 0}</string>
+							<string>{0, 0}</string>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentImages">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<object class="NSNull" id="4"/>
 							<reference ref="4"/>
 							<reference ref="4"/>
+							<reference ref="4"/>
 						</object>
 						<object class="NSColor" key="IBTintColor">
 							<int key="NSColorSpace">1</int>
@@ -610,7 +615,6 @@
 							<reference ref="634417433"/>
 							<reference ref="326163764"/>
 							<reference ref="938256702"/>
-							<reference ref="88728219"/>
 							<reference ref="848132519"/>
 							<reference ref="696928530"/>
 							<reference ref="742028380"/>
@@ -619,6 +623,7 @@
 							<reference ref="867832822"/>
 							<reference ref="553937568"/>
 							<reference ref="420136851"/>
+							<reference ref="88728219"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
--- a/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib	Sun Sep 26 23:48:03 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MapConfigViewController-iPhone.xib	Mon Sep 27 01:51:12 2010 +0200
@@ -45,42 +45,47 @@
 					<object class="IBUISegmentedControl" id="88728219">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{28, 166}, {240, 30}}</string>
+						<string key="NSFrame">{{20, 166}, {256, 30}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
 						<int key="IBSegmentControlStyle">2</int>
-						<int key="IBNumberOfSegments">3</int>
+						<int key="IBNumberOfSegments">4</int>
 						<int key="IBSelectedSegmentIndex">0</int>
 						<object class="NSArray" key="IBSegmentTitles">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>Random</string>
 							<string>Map</string>
 							<string>Maze</string>
+							<string>Mission</string>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentWidths">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<real value="0.0"/>
 							<real value="0.0"/>
 							<real value="0.0"/>
+							<real value="0.0"/>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentEnabledStates">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<boolean value="YES"/>
 							<boolean value="YES"/>
 							<boolean value="YES"/>
+							<boolean value="YES"/>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentContentOffsets">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>{0, 0}</string>
 							<string>{0, 0}</string>
 							<string>{0, 0}</string>
+							<string>{0, 0}</string>
 						</object>
 						<object class="NSMutableArray" key="IBSegmentImages">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<object class="NSNull" id="4"/>
 							<reference ref="4"/>
 							<reference ref="4"/>
+							<reference ref="4"/>
 						</object>
 					</object>
 					<object class="IBUISlider" id="938256702">
@@ -327,10 +332,10 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<reference ref="326163764"/>
 							<reference ref="634417433"/>
-							<reference ref="88728219"/>
 							<reference ref="565214171"/>
 							<reference ref="743202682"/>
 							<reference ref="938256702"/>
+							<reference ref="88728219"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>