merge
authorkoda
Thu, 23 Sep 2010 01:30:35 +0200
changeset 3899 88f8e7b1777e
parent 3898 0a9c3735a713 (diff)
parent 3896 59de68d541f1 (current diff)
child 3900 5fe24180fc72
merge
--- a/hedgewars/uStore.pas	Wed Sep 22 21:58:32 2010 +0200
+++ b/hedgewars/uStore.pas	Thu Sep 23 01:30:35 2010 +0200
@@ -732,8 +732,13 @@
 end;
 
 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
+var scale: GLfloat;
 begin
-DrawTexture(X - Source^.w shr 1, Top, Source)
+    if (Source^.w + 20) > cScreenWidth then
+        scale:= cScreenWidth / (Source^.w + 20)
+    else
+        scale:= 1.0;
+    DrawTexture(X - round(Source^.w * scale) div 2, Top, Source, scale)
 end;
 
 procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.h	Thu Sep 23 01:30:35 2010 +0200
@@ -31,6 +31,7 @@
 #define TEAMS_DIRECTORY()       [DOCUMENTS_FOLDER() stringByAppendingString:@"/Teams/"]
 #define WEAPONS_DIRECTORY()     [DOCUMENTS_FOLDER() stringByAppendingString:@"/Weapons/"]
 #define SCHEMES_DIRECTORY()     [DOCUMENTS_FOLDER() stringByAppendingString:@"/Schemes/"]
+#define SAVES_DIRECTORY()       [DOCUMENTS_FOLDER() stringByAppendingString:@"/Saves/"]
 
 #define GRAPHICS_DIRECTORY()    [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/"]
 #define HATS_DIRECTORY()        [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Graphics/Hats/"]
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Thu Sep 23 01:30:35 2010 +0200
@@ -192,17 +192,9 @@
     DLog(@"sending config %@", gameDictionary);
 
     if ([[gameDictionary allKeys] count] == 9) {
-        UIView *black = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)];
-        black.opaque = YES;
-        black.backgroundColor = [UIColor blackColor];
-        [self.view addSubview:black];
-        [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:gameDictionary];
-        [UIView beginAnimations:@"fading in from ingame" context:NULL];
-        [UIView setAnimationDuration:1];
-        black.alpha = 0;
-        [UIView commitAnimations];
-        [black performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
-        [black performSelector:@selector(release) withObject:nil afterDelay:1];
+        NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:gameDictionary,@"game_dictionary", @"",@"savefile",
+                                                                                    [NSNumber numberWithBool:NO],@"netgame", nil];
+        [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
     } else {
         DLog(@"gameconfig data not complete!!\nmapConfigViewController = %@\nteamConfigViewController = %@\nschemeWeaponConfigViewController = %@\n",
              mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController);
--- a/project_files/HedgewarsMobile/Classes/GameSetup.h	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.h	Thu Sep 23 01:30:35 2010 +0200
@@ -28,19 +28,24 @@
 
     NSInteger ipcPort;  // Port on which engine will listen
     TCPsocket csd;      // Client socket descriptor
+    
+    NSString *savePath;
+    BOOL isNetGame;
 }
 
 @property (nonatomic, retain) NSDictionary *systemSettings;
 @property (nonatomic, retain) NSDictionary *gameConfig;
+@property (nonatomic, retain) NSString *savePath;
 
 -(id) initWithDictionary:(NSDictionary *)gameDictionary;
 -(void) engineProtocol;
 -(void) startThread:(NSString *)selector;
 -(int)  sendToEngine:(NSString *)string;
+-(int)  sendToEngineNoSave:(NSString *)string;
 -(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor;
 -(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams;
 -(NSInteger) provideScheme:(NSString *)schemeName;
 
--(const char **)getSettings;
+-(const char **)getSettings:(NSString *)recordFile;
 
 @end
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Thu Sep 23 01:30:35 2010 +0200
@@ -24,12 +24,12 @@
 #import "SDL_net.h"
 #import "PascalImports.h"
 #import "CommodityFunctions.h"
+#import "NSStringExtra.h"
 
-#define BUFFER_SIZE 256
+#define BUFFER_SIZE 64
 
 @implementation GameSetup
-
-@synthesize systemSettings, gameConfig;
+@synthesize systemSettings, gameConfig, savePath;
 
 -(id) initWithDictionary:(NSDictionary *)gameDictionary {
     if (self = [super init]) {
@@ -40,7 +40,18 @@
         self.systemSettings = dictSett;
         [dictSett release];
 
-        self.gameConfig = gameDictionary;
+        self.gameConfig = [gameDictionary objectForKey:@"game_dictionary"];
+        isNetGame = [[gameDictionary objectForKey:@"netgame"] boolValue];
+        NSString *path = [gameDictionary objectForKey:@"savefile"];
+        // if path is empty it means i have to create a new file, otherwise i read from that file
+        if ([path isEqualToString:@""] == YES) {
+            NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
+            [outputFormatter setDateFormat:@"yyyy-MM-dd 'at' HH,mm"];
+            NSString *newDateString = [outputFormatter stringFromDate:[NSDate date]];
+            self.savePath = [SAVES_DIRECTORY() stringByAppendingFormat:@"%@.hws", newDateString];
+            [outputFormatter release];
+        } else
+            self.savePath = path;
     }
     return self;
 }
@@ -48,6 +59,7 @@
 -(void) dealloc {
     [gameConfig release];
     [systemSettings release];
+    [savePath release];
     [super dealloc];
 }
 
@@ -238,10 +250,19 @@
     [NSThread detachNewThreadSelector:usage toTarget:self withObject:nil];
 }
 
-// wrapper that computes the length of the message and then sends the command string
+// wrapper that computes the length of the message and then sends the command string, saving the command on a file
 -(int) sendToEngine: (NSString *)string {
     uint8_t length = [string length];
 
+    [[NSString stringWithFormat:@"%c%@",length,string] appendToFile:savePath];
+    SDLNet_TCP_Send(csd, &length , 1);
+    return SDLNet_TCP_Send(csd, [string UTF8String], length);
+}
+
+// wrapper that computes the length of the message and then sends the command string, skipping file writing
+-(int) sendToEngineNoSave: (NSString *)string {
+    uint8_t length = [string length];
+
     SDLNet_TCP_Send(csd, &length , 1);
     return SDLNet_TCP_Send(csd, [string UTF8String], length);
 }
@@ -294,8 +315,12 @@
             case 'C':
                 DLog(@"sending game config...\n%@",self.gameConfig);
 
-                // local game
-                [self sendToEngine:@"TL"];
+                if (isNetGame == YES)
+                    [self sendToEngineNoSave:@"TN"];
+                else
+                    [self sendToEngineNoSave:@"TL"];
+                NSString *saveHeader = @"TS";
+                [[NSString stringWithFormat:@"%c%@",[saveHeader length], saveHeader] appendToFile:savePath];
 
                 // seed info
                 [self sendToEngine:[self.gameConfig objectForKey:@"seed_command"]];
@@ -335,6 +360,8 @@
                 clientQuit = YES;
                 break;
             case 'e':
+                buffer[msgSize] = '\0';
+                [[NSString stringWithUTF8String:buffer] appendToFile:savePath];
                 sscanf(buffer, "%*s %d", &eProto);
                 short int netProto = 0;
                 char *versionStr;
@@ -361,7 +388,9 @@
             default:
                 // empty packet or just statistics -- in either cases gameTicks is sent
                 gameTicks = SDLNet_Read16 (&buffer[msgSize - 2]);
-                //DLog(@"engineProtocol - %d: received [%s]", gameTicks, buffer);
+                DLog(@"engineProtocol - %d: received [%s]", gameTicks, buffer);
+                buffer[msgSize] = '\0';
+                [[NSString stringWithUTF8String:buffer] appendToFile:savePath];
                 break;
         }
     }
@@ -380,7 +409,7 @@
 #pragma mark -
 #pragma mark Setting methods
 // returns an array of c-strings that are read by engine at startup
--(const char **)getSettings {
+-(const char **)getSettings: (NSString *)recordFile {
     NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort];
     NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]];
     CGRect screenBounds = [[UIScreen mainScreen] bounds];
@@ -421,7 +450,7 @@
     gameArgs[ 7] = [[[self.systemSettings objectForKey:@"music"] stringValue] UTF8String];       //isMusicEnabled
     gameArgs[ 8] = [[[self.systemSettings objectForKey:@"alternate"] stringValue] UTF8String];   //cAltDamage
     gameArgs[ 9] = NULL;                                                                         //unused
-    gameArgs[10] = NULL;                                                                         //recordFileName
+    gameArgs[10] = [recordFile UTF8String];                                                      //recordFileName
 
     [wSize release];
     [hSize release];
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.h	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.h	Thu Sep 23 01:30:35 2010 +0200
@@ -24,18 +24,21 @@
 @class SplitViewRootController;
 @class GameConfigViewController;
 @class AboutViewController;
+@class SavedGamesViewController;
 
 @interface MainMenuViewController : UIViewController <UIAlertViewDelegate> {
     UILabel *versionLabel;
     GameConfigViewController *gameConfigViewController;
     SplitViewRootController *settingsViewController;
     AboutViewController *aboutViewController;
+    SavedGamesViewController *savedGamesViewController;
 }
 
 @property (nonatomic,retain) IBOutlet UILabel *versionLabel;
 @property (nonatomic,retain) GameConfigViewController *gameConfigViewController;
 @property (nonatomic,retain) SplitViewRootController *settingsViewController;
 @property (nonatomic,retain) AboutViewController *aboutViewController;
+@property (nonatomic,retain) SavedGamesViewController *savedGamesViewController;
 
 -(IBAction) switchViews:(id)sender;
 
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Thu Sep 23 01:30:35 2010 +0200
@@ -27,9 +27,10 @@
 #import "GameConfigViewController.h"
 #import "SplitViewRootController.h"
 #import "AboutViewController.h"
+#import "SavedGamesViewController.h"
 
 @implementation MainMenuViewController
-@synthesize versionLabel, gameConfigViewController, settingsViewController, aboutViewController;
+@synthesize versionLabel, gameConfigViewController, settingsViewController, aboutViewController, savedGamesViewController;
 
 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
     return rotationManager(interfaceOrientation);
@@ -76,6 +77,11 @@
         NSString *directoryToCheck, *fileToCheck, *fileToUpdate;
         DLog(@"Creating necessary files");
         
+        // create an empty saves directory by deleting the previous one (saves are incompatible between releases)
+        if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
+            [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
+        [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
+        
         // if the settings file is already present, we merge current preferences with the update
         directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir];
         if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) {
@@ -225,7 +231,8 @@
 -(IBAction) switchViews:(id) sender {
     UIButton *button = (UIButton *)sender;
     UIAlertView *alert;
-    NSString *xib;
+    NSString *xib = nil;
+    NSString *debugStr = nil;
 
     playSound(@"clickSound");
     switch (button.tag) {
@@ -255,16 +262,7 @@
             [self presentModalViewController:self.settingsViewController animated:YES];
             break;
         case 3:
-            if (nil == self.aboutViewController) {
-                AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
-                about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
-                about.modalPresentationStyle = UIModalPresentationFormSheet;
-                self.aboutViewController = about;
-                [about release];
-            }
-            
-            [self presentModalViewController:self.aboutViewController animated:YES];
-            /*
+#ifdef DEBUG
             debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE()];
             UITextView *scroll = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width)];
             scroll.text = debugStr;
@@ -278,7 +276,28 @@
             [scroll addSubview:btn];
             [self.view addSubview:scroll];
             [scroll release];
-            */
+#else
+            if (nil == self.aboutViewController) {
+                AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
+                about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
+                about.modalPresentationStyle = UIModalPresentationFormSheet;
+                self.aboutViewController = about;
+                [about release];
+            }
+            
+            [self presentModalViewController:self.aboutViewController animated:YES];
+#endif
+            break;
+        case 4:
+            if (nil == self.savedGamesViewController) {
+                SavedGamesViewController *savedgames = [[SavedGamesViewController alloc] initWithNibName:@"SavedGamesViewController" bundle:nil];
+                savedgames.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
+                savedgames.modalPresentationStyle = UIModalPresentationFormSheet;
+                self.savedGamesViewController = savedgames;
+                [savedgames release];
+            }
+            
+            [self presentModalViewController:self.savedGamesViewController animated:YES];
             break;
         default:
             alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
@@ -303,6 +322,7 @@
     self.gameConfigViewController = nil;
     self.settingsViewController = nil;
     self.aboutViewController = nil;
+    self.savedGamesViewController = nil;
     MSG_DIDUNLOAD();
     [super viewDidUnload];
 }
@@ -312,6 +332,7 @@
     [settingsViewController release];
     [gameConfigViewController release];
     [aboutViewController release];
+    [savedGamesViewController release];
     [super dealloc];
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/NSStringExtra.h	Thu Sep 23 01:30:35 2010 +0200
@@ -0,0 +1,29 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * File created on 21/09/2010.
+ */
+
+
+#import <UIKit/UIKit.h>
+
+@interface NSString (extra)
+
+-(BOOL) appendToFile:(NSString *)path;
+-(BOOL) appendToFile:(NSString *)path usingEncoding:(NSStringEncoding) encoding;
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/NSStringExtra.m	Thu Sep 23 01:30:35 2010 +0200
@@ -0,0 +1,55 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * File created on 21/09/2010.
+ */
+
+
+#import "NSStringExtra.h"
+
+@implementation NSString (extra)
+
+-(BOOL) appendToFile:(NSString *)path {
+    NSOutputStream* os = [[NSOutputStream alloc] initToFileAtPath:path append:YES];
+    NSData *allData = [self dataUsingEncoding:NSUTF8StringEncoding];
+
+    [os open];
+    [os write:[allData bytes] maxLength:[allData length]];
+    [os close];
+    
+    [os release];
+    return YES;
+}
+
+
+// by http://iphonedevelopment.blogspot.com/2010/08/nsstring-appendtofileusingencoding.html
+-(BOOL) appendToFile:(NSString *)path usingEncoding:(NSStringEncoding) encoding {
+    NSFileHandle *fh = [NSFileHandle fileHandleForWritingAtPath:path]; 
+    if (fh == nil)
+        return [self writeToFile:path atomically:YES encoding:encoding error:nil];
+    
+    [fh truncateFileAtOffset:[fh seekToEndOfFile]];
+    NSData *encoded = [self dataUsingEncoding:encoding];
+    
+    if (encoded == nil) 
+        return NO;
+    
+    [fh writeData:encoded];
+    return YES;
+}
+
+@end
--- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m	Thu Sep 23 01:30:35 2010 +0200
@@ -78,16 +78,25 @@
 }
 
 // main routine for calling the actual game engine
--(IBAction) startSDLgame: (NSDictionary *)gameDictionary {
+-(void) startSDLgame:(NSDictionary *)gameDictionary {
+    UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
+
+    UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aWin.frame.size.width, aWin.frame.size.height)];
+    blackView.opaque = YES;
+    blackView.backgroundColor = [UIColor blackColor];
+    [aWin addSubview:blackView];
+
     // pull out useful configuration info from various files
     GameSetup *setup = [[GameSetup alloc] initWithDictionary:gameDictionary];
-
-    [setup startThread:@"engineProtocol"];
-    const char **gameArgs = [setup getSettings];
+    NSNumber *isNetGameNum = [gameDictionary objectForKey:@"netgame"];
+    
+    if ([isNetGameNum boolValue] == NO)
+        [setup startThread:@"engineProtocol"];
+    const char **gameArgs = [setup getSettings:[gameDictionary objectForKey:@"savefile"]];
     [setup release];
 
     // since the sdlwindow is not yet created, we add the overlayController with a delay
-    [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:0.1];
+    [self performSelector:@selector(displayOverlayLater:) withObject:isNetGameNum afterDelay:0.1];
 
     // this is the pascal fuction that starts the game (wrapped around isInGame)
     isInGame = YES;
@@ -95,15 +104,16 @@
     isInGame = NO;
     free(gameArgs);
 
-    // bring the uiwindow below in front
-    UIWindow *aWin = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
     [aWin makeKeyAndVisible];
-
-    // notice that in the simulator this reports 2 windows
-    DLog(@"%@",[[UIApplication sharedApplication] windows]);
+    [UIView beginAnimations:@"fading in from ingame" context:NULL];
+    [UIView setAnimationDuration:1];
+    blackView.alpha = 0;
+    [UIView commitAnimations];
+    [blackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1];
+    [blackView performSelector:@selector(release) withObject:nil afterDelay:1]; 
 }
 
--(void) displayOverlayLater {
+-(void) displayOverlayLater:(NSNumber *)isNetGame {
     // overlay with controls, become visible later, with a transparency effect
     OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil];
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h	Thu Sep 23 01:30:35 2010 +0200
@@ -0,0 +1,36 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * File created on 22/09/2010.
+ */
+
+
+#import <UIKit/UIKit.h>
+
+
+@interface SavedGamesViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>  {
+    UITableView *tableView;
+    NSMutableArray *listOfSavegames;
+}
+
+@property (nonatomic,retain) IBOutlet UITableView *tableView;
+@property (nonatomic,retain) NSMutableArray *listOfSavegames;
+
+
+-(IBAction) buttonPressed:(id) sender;
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m	Thu Sep 23 01:30:35 2010 +0200
@@ -0,0 +1,112 @@
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * File created on 22/09/2010.
+ */
+
+
+#import "SavedGamesViewController.h"
+#import "SDL_uikitappdelegate.h"
+#import "CommodityFunctions.h"
+
+@implementation SavedGamesViewController
+@synthesize tableView, listOfSavegames;
+
+-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+    return rotationManager(interfaceOrientation);
+}
+
+-(void) viewDidLoad {
+    self.tableView.backgroundView = nil;
+
+    [super viewDidLoad];
+}
+
+-(void) viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+
+    NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SAVES_DIRECTORY() error:NULL];
+    NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
+    self.listOfSavegames = array;
+    [array release];
+
+    [self.tableView reloadData];    
+}
+
+-(IBAction) buttonPressed:(id) sender {
+    playSound(@"backSound");
+    [[self parentViewController] dismissModalViewControllerAnimated:YES];
+}
+
+#pragma mark -
+#pragma mark Table view data source
+-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+
+-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return [self.listOfSavegames count];
+}
+
+-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    static NSString *CellIdentifier = @"Cell";
+
+    UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
+    if (cell == nil)
+        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
+
+    // first all the names, then the title (which is offset 5)
+    cell.textLabel.text = [[self.listOfSavegames objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
+    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+
+    return cell;
+}
+
+#pragma mark -
+#pragma mark Table view delegate
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
+    
+    NSString *filePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:[indexPath row]]];
+    
+    NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:
+                                      [NSDictionary dictionary],@"game_dictionary",
+                                      filePath,@"savefile",
+                                      [NSNumber numberWithBool:NO],@"netgame",
+                                      nil];
+    [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary];
+}
+
+#pragma mark -
+#pragma mark Memory Management
+-(void) didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+}
+
+-(void) viewDidUnload {
+    self.tableView = nil;
+    self.listOfSavegames = nil;
+    [super viewDidUnload];
+}
+
+-(void) dealloc {
+    [tableView release];
+    [listOfSavegames release];
+    [super dealloc];
+}
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.xib	Thu Sep 23 01:30:35 2010 +0200
@@ -0,0 +1,502 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
+	<data>
+		<int key="IBDocument.SystemTarget">1024</int>
+		<string key="IBDocument.SystemVersion">10F569</string>
+		<string key="IBDocument.InterfaceBuilderVersion">788</string>
+		<string key="IBDocument.AppKitVersion">1038.29</string>
+		<string key="IBDocument.HIToolboxVersion">461.00</string>
+		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+			<string key="NS.object.0">117</string>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<integer value="2"/>
+		</object>
+		<object class="NSArray" key="IBDocument.PluginDependencies">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+		</object>
+		<object class="NSMutableDictionary" key="IBDocument.Metadata">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<object class="NSArray" key="dict.sortedKeys" id="0">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+			</object>
+			<object class="NSMutableArray" key="dict.values">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+			</object>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<object class="IBProxyObject" id="841351856">
+				<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+				<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+			</object>
+			<object class="IBProxyObject" id="606714003">
+				<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+				<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+			</object>
+			<object class="IBUIView" id="766721923">
+				<reference key="NSNextResponder"/>
+				<int key="NSvFlags">292</int>
+				<object class="NSMutableArray" key="NSSubviews">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<object class="IBUIToolbar" id="832454237">
+						<reference key="NSNextResponder" ref="766721923"/>
+						<int key="NSvFlags">290</int>
+						<string key="NSFrameSize">{408, 44}</string>
+						<reference key="NSSuperview" ref="766721923"/>
+						<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+						<object class="NSMutableArray" key="IBUIItems">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<object class="IBUIBarButtonItem" id="422926197">
+								<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+								<int key="IBUIStyle">1</int>
+								<reference key="IBUIToolbar" ref="832454237"/>
+								<int key="IBUISystemItemIdentifier">0</int>
+							</object>
+						</object>
+					</object>
+					<object class="IBUITableView" id="399289716">
+						<reference key="NSNextResponder" ref="766721923"/>
+						<int key="NSvFlags">274</int>
+						<string key="NSFrame">{{0, 44}, {408, 414}}</string>
+						<reference key="NSSuperview" ref="766721923"/>
+						<object class="NSColor" key="IBUIBackgroundColor">
+							<int key="NSColorSpace">1</int>
+							<bytes key="NSRGB">MCAwIDAgMAA</bytes>
+						</object>
+						<bool key="IBUIClipsSubviews">YES</bool>
+						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+						<bool key="IBUIAlwaysBounceVertical">YES</bool>
+						<int key="IBUIStyle">1</int>
+						<int key="IBUISeparatorStyle">2</int>
+						<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+						<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+						<float key="IBUIRowHeight">44</float>
+						<float key="IBUISectionHeaderHeight">10</float>
+						<float key="IBUISectionFooterHeight">10</float>
+					</object>
+				</object>
+				<string key="NSFrameSize">{408, 458}</string>
+				<reference key="NSSuperview"/>
+				<object class="NSColor" key="IBUIBackgroundColor">
+					<int key="NSColorSpace">3</int>
+					<bytes key="NSWhite">MQA</bytes>
+				</object>
+				<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+				<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+					<int key="interfaceOrientation">3</int>
+				</object>
+				<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+			</object>
+		</object>
+		<object class="IBObjectContainer" key="IBDocument.Objects">
+			<object class="NSMutableArray" key="connectionRecords">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">view</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="766721923"/>
+					</object>
+					<int key="connectionID">3</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchEventConnection" key="connection">
+						<string key="label">buttonPressed:</string>
+						<reference key="source" ref="422926197"/>
+						<reference key="destination" ref="841351856"/>
+					</object>
+					<int key="connectionID">6</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">dataSource</string>
+						<reference key="source" ref="399289716"/>
+						<reference key="destination" ref="841351856"/>
+					</object>
+					<int key="connectionID">8</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">delegate</string>
+						<reference key="source" ref="399289716"/>
+						<reference key="destination" ref="841351856"/>
+					</object>
+					<int key="connectionID">9</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">tableView</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="399289716"/>
+					</object>
+					<int key="connectionID">10</int>
+				</object>
+			</object>
+			<object class="IBMutableOrderedSet" key="objectRecords">
+				<object class="NSArray" key="orderedObjects">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<object class="IBObjectRecord">
+						<int key="objectID">0</int>
+						<reference key="object" ref="0"/>
+						<reference key="children" ref="1000"/>
+						<nil key="parent"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-1</int>
+						<reference key="object" ref="841351856"/>
+						<reference key="parent" ref="0"/>
+						<string key="objectName">File's Owner</string>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-2</int>
+						<reference key="object" ref="606714003"/>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">2</int>
+						<reference key="object" ref="766721923"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="832454237"/>
+							<reference ref="399289716"/>
+						</object>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">4</int>
+						<reference key="object" ref="832454237"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="422926197"/>
+						</object>
+						<reference key="parent" ref="766721923"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">5</int>
+						<reference key="object" ref="422926197"/>
+						<reference key="parent" ref="832454237"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">7</int>
+						<reference key="object" ref="399289716"/>
+						<reference key="parent" ref="766721923"/>
+					</object>
+				</object>
+			</object>
+			<object class="NSMutableDictionary" key="flattenedProperties">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="NSArray" key="dict.sortedKeys">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<string>-1.CustomClassName</string>
+					<string>-2.CustomClassName</string>
+					<string>2.IBEditorWindowLastContentRect</string>
+					<string>2.IBPluginDependency</string>
+					<string>4.IBPluginDependency</string>
+					<string>5.IBPluginDependency</string>
+					<string>7.IBPluginDependency</string>
+				</object>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<string>SavedGamesViewController</string>
+					<string>UIResponder</string>
+					<string>{{677, 547}, {408, 458}}</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				</object>
+			</object>
+			<object class="NSMutableDictionary" key="unlocalizedProperties">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<reference key="dict.sortedKeys" ref="0"/>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+				</object>
+			</object>
+			<nil key="activeLocalization"/>
+			<object class="NSMutableDictionary" key="localizations">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<reference key="dict.sortedKeys" ref="0"/>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+				</object>
+			</object>
+			<nil key="sourceID"/>
+			<int key="maxID">10</int>
+		</object>
+		<object class="IBClassDescriber" key="IBDocument.Classes">
+			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBPartialClassDescription">
+					<string key="className">SavedGamesViewController</string>
+					<string key="superclassName">UIViewController</string>
+					<object class="NSMutableDictionary" key="actions">
+						<string key="NS.key.0">buttonPressed:</string>
+						<string key="NS.object.0">id</string>
+					</object>
+					<object class="NSMutableDictionary" key="actionInfosByName">
+						<string key="NS.key.0">buttonPressed:</string>
+						<object class="IBActionInfo" key="NS.object.0">
+							<string key="name">buttonPressed:</string>
+							<string key="candidateClassName">id</string>
+						</object>
+					</object>
+					<object class="NSMutableDictionary" key="outlets">
+						<string key="NS.key.0">tableView</string>
+						<string key="NS.object.0">UITableView</string>
+					</object>
+					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
+						<string key="NS.key.0">tableView</string>
+						<object class="IBToOneOutletInfo" key="NS.object.0">
+							<string key="name">tableView</string>
+							<string key="candidateClassName">UITableView</string>
+						</object>
+					</object>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">Classes/SavedGamesViewController.h</string>
+					</object>
+				</object>
+			</object>
+			<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="786211723">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIBarButtonItem</string>
+					<string key="superclassName">UIBarItem</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIBarItem</string>
+					<string key="superclassName">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIResponder</string>
+					<string key="superclassName">NSObject</string>
+					<reference key="sourceIdentifier" ref="786211723"/>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIScrollView</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UISearchBar</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UISearchDisplayController</string>
+					<string key="superclassName">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UITableView</string>
+					<string key="superclassName">UIScrollView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITableView.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIToolbar</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIToolbar.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIView</string>
+					<string key="superclassName">UIResponder</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<string key="superclassName">UIResponder</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+					</object>
+				</object>
+			</object>
+		</object>
+		<int key="IBDocument.localizationMode">0</int>
+		<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
+		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+			<integer value="1024" key="NS.object.0"/>
+		</object>
+		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+			<integer value="3100" key="NS.object.0"/>
+		</object>
+		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+		<string key="IBDocument.LastKnownRelativeProjectPath">../Hedgewars.xcodeproj</string>
+		<int key="IBDocument.defaultPropertyAccessControl">3</int>
+		<string key="IBCocoaTouchPluginVersion">117</string>
+	</data>
+</archive>
--- a/project_files/HedgewarsMobile/Classes/SupportViewController.h	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SupportViewController.h	Thu Sep 23 01:30:35 2010 +0200
@@ -1,14 +1,26 @@
-//
-//  SupportViewController.h
-//  Hedgewars
-//
-//  Created by Vittorio on 19/09/10.
-//  Copyright 2010 __MyCompanyName__. All rights reserved.
-//
+/*
+ * Hedgewars-iOS, a Hedgewars port for iOS devices
+ * Copyright (c) 2009-2010 Vittorio Giovara <vittorio.giovara@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * File created on 19/09/2010.
+ */
+
 
 #import <UIKit/UIKit.h>
 
-
 @interface SupportViewController : UIViewController {
 
 }
--- a/project_files/HedgewarsMobile/Classes/SupportViewController.m	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SupportViewController.m	Thu Sep 23 01:30:35 2010 +0200
@@ -18,6 +18,7 @@
  * File created on 19/09/2010.
  */
 
+
 #import "SupportViewController.h"
 #import "CommodityFunctions.h"
 
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Thu Sep 23 01:30:35 2010 +0200
@@ -25,6 +25,9 @@
 		1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
 		28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; };
 		28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; };
+		611D9B12124949D000008271 /* NSStringExtra.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9B11124949D000008271 /* NSStringExtra.m */; };
+		611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 611D9BF912497E9800008271 /* SavedGamesViewController.m */; };
+		611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 611D9BFA12497E9800008271 /* SavedGamesViewController.xib */; };
 		611E03E711FA747C0077A41E /* libvorbis.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 611E037C11FA74590077A41E /* libvorbis.a */; };
 		611E0E5111FA92170077A41E /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 611E0E5011FA92130077A41E /* libfreetype.a */; };
 		611E0EE711FB20610077A41E /* ammoButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 611E0EE511FB20610077A41E /* ammoButton.png */; };
@@ -692,6 +695,11 @@
 		28FD14FF0DC6FC520079059D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
 		28FD15070DC6FC5B0079059D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
 		32CA4F630368D1EE00C91783 /* Hedgewars_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hedgewars_Prefix.pch; sourceTree = "<group>"; };
+		611D9B10124949D000008271 /* NSStringExtra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSStringExtra.h; path = Classes/NSStringExtra.h; sourceTree = "<group>"; };
+		611D9B11124949D000008271 /* NSStringExtra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSStringExtra.m; path = Classes/NSStringExtra.m; sourceTree = "<group>"; };
+		611D9BF812497E9800008271 /* SavedGamesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedGamesViewController.h; sourceTree = "<group>"; };
+		611D9BF912497E9800008271 /* SavedGamesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedGamesViewController.m; sourceTree = "<group>"; };
+		611D9BFA12497E9800008271 /* SavedGamesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SavedGamesViewController.xib; sourceTree = "<group>"; };
 		611E02EC11FA74580077A41E /* cocos2d-iphone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "cocos2d-iphone.xcodeproj"; path = "../../../Library/cocos2d/cocos2d-iphone.xcodeproj"; sourceTree = SOURCE_ROOT; };
 		611E0E4B11FA92130077A41E /* freetype.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = freetype.xcodeproj; path = "../../../Library/freetype/Xcode-iPhoneOS/freetype.xcodeproj"; sourceTree = SOURCE_ROOT; };
 		611E0EE511FB20610077A41E /* ammoButton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ammoButton.png; path = Resources/Overlay/ammoButton.png; sourceTree = "<group>"; };
@@ -920,6 +928,7 @@
 			children = (
 				6163EE4D11CC247D001C0453 /* Game Config */,
 				6163EE4C11CC2478001C0453 /* Settings Pages */,
+				611D9BF312497B7700008271 /* Other Controllers */,
 				6163EE6C11CC253F001C0453 /* Overlay */,
 				616591F011CA9BA200D6E256 /* MainMenuViewController.h */,
 				616591F111CA9BA200D6E256 /* MainMenuViewController.m */,
@@ -972,6 +981,8 @@
 				6165922B11CA9BD500D6E256 /* SquareButtonView.m */,
 				6165922C11CA9BD500D6E256 /* UIImageExtra.h */,
 				6165922D11CA9BD500D6E256 /* UIImageExtra.m */,
+				611D9B10124949D000008271 /* NSStringExtra.h */,
+				611D9B11124949D000008271 /* NSStringExtra.m */,
 			);
 			name = "Other Sources";
 			sourceTree = "<group>";
@@ -1027,6 +1038,19 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
+		611D9BF312497B7700008271 /* Other Controllers */ = {
+			isa = PBXGroup;
+			children = (
+				61F2E7CB1205EDE0005734F7 /* AboutViewController.h */,
+				61F2E7CC1205EDE0005734F7 /* AboutViewController.m */,
+				61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */,
+				611D9BF812497E9800008271 /* SavedGamesViewController.h */,
+				611D9BF912497E9800008271 /* SavedGamesViewController.m */,
+				611D9BFA12497E9800008271 /* SavedGamesViewController.xib */,
+			);
+			name = "Other Controllers";
+			sourceTree = "<group>";
+		};
 		611E02ED11FA74580077A41E /* Products */ = {
 			isa = PBXGroup;
 			children = (
@@ -1208,9 +1232,6 @@
 				616591F611CA9BA200D6E256 /* OverlayViewController.h */,
 				616591F711CA9BA200D6E256 /* OverlayViewController.m */,
 				6165925011CA9CB400D6E256 /* OverlayViewController.xib */,
-				61F2E7CB1205EDE0005734F7 /* AboutViewController.h */,
-				61F2E7CC1205EDE0005734F7 /* AboutViewController.m */,
-				61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */,
 				611EEAEB122B2A4D00DF6938 /* HelpPageViewController.h */,
 				611EEAEC122B2A4D00DF6938 /* HelpPageViewController.m */,
 				611EEAED122B2A4D00DF6938 /* HelpPageLobbyViewController.xib */,
@@ -2029,6 +2050,7 @@
 				61842B40122B66280096E335 /* helpleft.png in Resources */,
 				6199E83A124647DE00DADF8C /* SupportViewController.xib in Resources */,
 				6199E86D12464A8E00DADF8C /* surpise.png in Resources */,
+				611D9BFC12497E9800008271 /* SavedGamesViewController.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2155,6 +2177,8 @@
 				61F2E7CE1205EDE0005734F7 /* AboutViewController.m in Sources */,
 				611EEAEE122B2A4D00DF6938 /* HelpPageViewController.m in Sources */,
 				6199E839124647DE00DADF8C /* SupportViewController.m in Sources */,
+				611D9B12124949D000008271 /* NSStringExtra.m in Sources */,
+				611D9BFB12497E9800008271 /* SavedGamesViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
--- a/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib	Wed Sep 22 21:58:32 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/MainMenuViewController-iPad.xib	Thu Sep 23 01:30:35 2010 +0200
@@ -120,7 +120,7 @@
 					<object class="IBUIButton" id="95106947">
 						<reference key="NSNextResponder" ref="191373211"/>
 						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{20, 729}, {18, 19}}</string>
+						<string key="NSFrame">{{20, 19}, {18, 19}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<int key="IBUITag">3</int>
@@ -182,11 +182,30 @@
 							<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
 						</object>
 						<reference key="IBUINormalTitleShadowColor" ref="112471976"/>
-						<object class="NSCustomResource" key="IBUINormalImage">
+						<object class="NSCustomResource" key="IBUINormalImage" id="278995865">
 							<string key="NSClassName">NSImage</string>
 							<string key="NSResourceName">settingsButton.png</string>
 						</object>
 					</object>
+					<object class="IBUIButton" id="894101036">
+						<reference key="NSNextResponder" ref="191373211"/>
+						<int key="NSvFlags">292</int>
+						<string key="NSFrame">{{20, 686}, {72, 62}}</string>
+						<reference key="NSSuperview" ref="191373211"/>
+						<bool key="IBUIOpaque">NO</bool>
+						<int key="IBUITag">4</int>
+						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
+						<int key="IBUIContentHorizontalAlignment">0</int>
+						<int key="IBUIContentVerticalAlignment">0</int>
+						<reference key="IBUIFont" ref="917635782"/>
+						<reference key="IBUIHighlightedTitleColor" ref="918890028"/>
+						<object class="NSColor" key="IBUINormalTitleColor">
+							<int key="NSColorSpace">1</int>
+							<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+						</object>
+						<reference key="IBUINormalTitleShadowColor" ref="112471976"/>
+						<reference key="IBUINormalImage" ref="278995865"/>
+					</object>
 				</object>
 				<string key="NSFrameSize">{1024, 768}</string>
 				<reference key="NSSuperview"/>
@@ -255,6 +274,15 @@
 					</object>
 					<int key="connectionID">54</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchEventConnection" key="connection">
+						<string key="label">switchViews:</string>
+						<reference key="source" ref="894101036"/>
+						<reference key="destination" ref="372490531"/>
+						<int key="IBEventType">7</int>
+					</object>
+					<int key="connectionID">89</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -273,9 +301,10 @@
 							<reference ref="976741091"/>
 							<reference ref="177360137"/>
 							<reference ref="607338789"/>
-							<reference ref="95106947"/>
 							<reference ref="898948205"/>
 							<reference ref="867308721"/>
+							<reference ref="95106947"/>
+							<reference ref="894101036"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -322,6 +351,11 @@
 						<reference key="object" ref="976741091"/>
 						<reference key="parent" ref="191373211"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">88</int>
+						<reference key="object" ref="894101036"/>
+						<reference key="parent" ref="191373211"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -338,6 +372,7 @@
 					<string>45.IBPluginDependency</string>
 					<string>50.IBPluginDependency</string>
 					<string>52.IBPluginDependency</string>
+					<string>88.IBPluginDependency</string>
 				</object>
 				<object class="NSMutableArray" key="dict.values">
 					<bool key="EncodedWithXMLCoder">YES</bool>
@@ -351,6 +386,7 @@
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -369,7 +405,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">87</int>
+			<int key="maxID">89</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">