# HG changeset patch # User koda # Date 1293762581 -3600 # Node ID 5ea3d182415e4327e7584b1aa68197931d232ac3 # Parent 42adc7c11980f677bf4c9d28fc267b8daeceb92b# Parent 68f9b331014a30f7ec5bffee08c20b23fbf3a20d merge and fix my typos diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/GameConfigViewController.m --- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Fri Dec 31 03:29:41 2010 +0100 @@ -25,6 +25,7 @@ #import "TeamConfigViewController.h" #import "SchemeWeaponConfigViewController.h" #import "HelpPageViewController.h" +#import "StatsPageViewController.h" #import "CommodityFunctions.h" #import "UIImageExtra.h" #import "PascalImports.h" @@ -226,19 +227,30 @@ [NSNumber numberWithInt:self.interfaceOrientation],@"orientation", nil]; - NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys:gameDictionary,@"game_dictionary", @"",@"savefile", - [NSNumber numberWithBool:NO],@"netgame", nil]; - if (IS_IPAD()) - [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; + NSDictionary *allDataNecessary = [NSDictionary dictionaryWithObjectsAndKeys: + gameDictionary,@"game_dictionary", + [NSNumber numberWithBool:NO],@"netgame", + @"",@"savefile", + nil]; + + + StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; + statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; + if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) + statsPage.modalPresentationStyle = UIModalPresentationPageSheet; + [self presentModalViewController:statsPage animated:NO]; + + NSArray *stats = [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; + if ([stats count] == 0) + [statsPage dismissModalViewControllerAnimated:NO]; else { - // this causes a sporadic crash on the ipad but without this rotation doesn't work on iphone - UIViewController *dummy = [[UIViewController alloc] init]; - [self presentModalViewController:dummy animated:NO]; - [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; - [self dismissModalViewControllerAnimated:NO]; - [dummy release]; + statsPage.statsArray = stats; + [statsPage.tableView reloadData]; + [statsPage viewWillAppear:YES]; } + + [statsPage release]; } -(void) loadNiceHogs { diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/GameSetup.h --- a/project_files/HedgewarsMobile/Classes/GameSetup.h Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.h Fri Dec 31 03:29:41 2010 +0100 @@ -25,11 +25,12 @@ @interface GameSetup : NSObject { NSDictionary *systemSettings; NSDictionary *gameConfig; + NSMutableArray *statsArray; NSInteger ipcPort; // Port on which engine will listen TCPsocket csd; // Client socket descriptor TCPsocket esd; // External socket descriptor - + NSString *savePath; BOOL isNetGame; BOOL menuStyle; @@ -37,6 +38,7 @@ @property (nonatomic, retain) NSDictionary *systemSettings; @property (nonatomic, retain) NSDictionary *gameConfig; +@property (nonatomic, retain) NSMutableArray *statsArray; @property (nonatomic, retain) NSString *savePath; @property (assign) BOOL menuStyle; @@ -48,6 +50,6 @@ -(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams; -(NSInteger) provideScheme:(NSString *)schemeName; --(const char **)getSettings:(NSString *)recordFile; +-(const char **)getGameSettings:(NSString *)recordFile; @end diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/GameSetup.m --- a/project_files/HedgewarsMobile/Classes/GameSetup.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Fri Dec 31 03:29:41 2010 +0100 @@ -28,7 +28,7 @@ #define BUFFER_SIZE 255 // like in original frontend @implementation GameSetup -@synthesize systemSettings, gameConfig, savePath, menuStyle; +@synthesize systemSettings, gameConfig, statsArray, savePath, menuStyle; -(id) initWithDictionary:(NSDictionary *)gameDictionary { if (self = [super init]) { @@ -57,11 +57,14 @@ [outputFormatter release]; } else self.savePath = path; + + self.statsArray = nil; } return self; } -(void) dealloc { + [statsArray release]; [gameConfig release]; [systemSettings release]; [savePath release]; @@ -204,12 +207,12 @@ #pragma mark - #pragma mark Network relevant code --(void) dumpRawData:(const uint8_t*)buffer ofSize:(uint8_t) length { +-(void) dumpRawData:(const char *)buffer ofSize:(uint8_t) length { // is it performant to reopen the stream every time? NSOutputStream *os = [[NSOutputStream alloc] initToFileAtPath:self.savePath append:YES]; [os open]; [os write:&length maxLength:1]; - [os write:buffer maxLength:length]; + [os write:(const uint8_t *)buffer maxLength:length]; [os close]; [os release]; } @@ -218,7 +221,7 @@ -(int) sendToEngine:(NSString *)string { uint8_t length = [string length]; - [self dumpRawData:(const uint8_t *)[string UTF8String] ofSize:length]; + [self dumpRawData:[string UTF8String] ofSize:length]; SDLNet_TCP_Send(csd, &length, 1); return SDLNet_TCP_Send(csd, [string UTF8String], length); } @@ -238,8 +241,9 @@ IPaddress ip; int eProto; BOOL clientQuit; - uint8_t buffer[BUFFER_SIZE]; + char const buffer[BUFFER_SIZE]; uint8_t msgSize; + int statMaxCapacity = 10-3; clientQuit = NO; csd = NULL; @@ -268,10 +272,10 @@ while (!clientQuit) { msgSize = 0; - memset(buffer, '\0', BUFFER_SIZE); + memset((void *)buffer, '\0', BUFFER_SIZE); if (SDLNet_TCP_Recv(csd, &msgSize, sizeof(uint8_t)) <= 0) break; - if (SDLNet_TCP_Recv(csd, buffer, msgSize) <=0) + if (SDLNet_TCP_Recv(csd, (void *)buffer, msgSize) <= 0) break; switch (buffer[0]) { @@ -283,7 +287,7 @@ else [self sendToEngineNoSave:@"TL"]; NSString *saveHeader = @"TS"; - [self dumpRawData:(const uint8_t *)[saveHeader UTF8String] ofSize:[saveHeader length]]; + [self dumpRawData:[saveHeader UTF8String] ofSize:[saveHeader length]]; // seed info [self sendToEngine:[self.gameConfig objectForKey:@"seed_command"]]; @@ -345,36 +349,38 @@ } break; case 'i': + if (self.statsArray == nil) + self.statsArray = [[NSMutableArray alloc] initWithCapacity:statMaxCapacity]; + NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]]; + NSString *arg = [[tempStr componentsSeparatedByString:@" "] objectAtIndex:0]; + int index = [arg length] + 3; switch (buffer[1]) { - case 'r': - DLog(@"Winning team: %s", &buffer[2]); + case 'r': // winning team + [self.statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:0]; break; - case 'D': - DLog(@"Best Shot: %s", &buffer[2]); + case 'D': // best shot + [self.statsArray addObject:[NSString stringWithFormat:@"The best shot award was won by %s with %@ points", &buffer[index], arg]]; break; - case 'k': - DLog(@"Best Hedgehog: %s", &buffer[2]); - break; - case 'K': - DLog(@"Hogs Killed: %s", &buffer[2]); + case 'k': // best hedgehog + [self.statsArray addObject:[NSString stringWithFormat:@"The best killer is %s with %@ kills in a turn", &buffer[index], arg]]; break; - case 'H': - //something about team health + case 'K': // number of hogs killed + [self.statsArray addObject:[NSString stringWithFormat:@"A total of %@ hedgehog(s) were killed during this round", arg]]; break; - case 'T': - // local team stats + case 'H': //something about team health break; - case 'P': - // player postion + case 'T': // local team stats + break; + case 'P': // player postion break; - case 's': - DLog(@"Most self damage: %s", &buffer[2]); + case 's': // self damage + [self.statsArray addObject:[NSString stringWithFormat:@"%s thought it's good to shoot his own hedgehogs with %@ points", &buffer[index], arg]]; break; - case 'S': - DLog(@"Most friendly fire: %s", &buffer[2]); + case 'S': // friendly fire + [self.statsArray addObject:[NSString stringWithFormat:@"%s killed %@ of his own hedgehogs", &buffer[index], arg]]; break; - case 'B': - DLog(@"Most turn skipped by: %s", &buffer[2]); + case 'B': // turn skipped + [self.statsArray addObject:[NSString stringWithFormat:@"%s was scared and skipped turn %@ times", &buffer[index], arg]]; break; default: DLog(@"Unhandled stat message, see statsPage.cpp"); @@ -384,7 +390,6 @@ case 'q': // game ended, can remove the savefile [[NSFileManager defaultManager] removeItemAtPath:self.savePath error:nil]; - //[[NSNotificationCenter defaultCenter] postNotificationName:@"removedSave" object:nil]; // and remove + disable the overlay [[NSNotificationCenter defaultCenter] postNotificationName:@"remove overlay" object:nil]; break; @@ -408,7 +413,7 @@ #pragma mark - #pragma mark Setting methods // returns an array of c-strings that are read by engine at startup --(const char **)getSettings: (NSString *)recordFile { +-(const char **)getGameSettings:(NSString *)recordFile { NSInteger width, height; NSString *ipcString = [[NSString alloc] initWithFormat:@"%d", ipcPort]; NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]]; @@ -431,11 +436,11 @@ NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", width]; NSString *verticalSize = [[NSString alloc] initWithFormat:@"%d", height]; - const char **gameArgs = (const char**) malloc(sizeof(char *) * 10); - NSInteger tmpQuality; + const char **gameArgs = (const char **)malloc(sizeof(char *) * 10); BOOL enhanced = [[self.systemSettings objectForKey:@"enhanced"] boolValue]; NSString *modelId = modelType(); + NSInteger tmpQuality; if ([modelId hasPrefix:@"iPhone1"] || [modelId hasPrefix:@"iPod1,1"] || [modelId hasPrefix:@"iPod2,1"]) // = iPhone and iPhone 3G or iPod Touch or iPod Touch 2G tmpQuality = 0x00000001 | 0x00000002 | 0x00000008 | 0x00000040; // rqLowRes | rqBlurryLand | rqSimpleRope | rqKillFlakes else if ([modelId hasPrefix:@"iPhone2"] || [modelId hasPrefix:@"iPod3"]) // = iPhone 3GS or iPod Touch 3G diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/HelpPageViewController.m --- a/project_files/HedgewarsMobile/Classes/HelpPageViewController.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/HelpPageViewController.m Fri Dec 31 03:29:41 2010 +0100 @@ -36,10 +36,10 @@ // on iPhone the XIBs contain UIScrollView -(void) viewDidLoad { - if (scrollView.tag == 0) + if (scrollView.tag == 0) // ipad scrollView.contentSize = CGSizeMake(480,650); - else - scrollView.contentSize = CGSizeMake(480,460); + else // iphone + scrollView.contentSize = CGSizeMake(480,470); scrollView.maximumZoomScale = 4.0; scrollView.minimumZoomScale = 0.75; scrollView.clipsToBounds = YES; @@ -57,7 +57,6 @@ [super dealloc]; } -// on iPad the XIBs contain UIControl -(IBAction) dismiss { [UIView beginAnimations:@"helpingame" context:NULL]; self.view.alpha = 0; diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/MainMenuViewController.m --- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Fri Dec 31 03:29:41 2010 +0100 @@ -99,8 +99,6 @@ createWeaponNamed(@"Minefield", 5); createWeaponNamed(@"Thinking with Portals", 6); // merge not needed because weapons not present in the set are 0ed by GameSetup - - DLog(@"Success"); } #pragma mark - diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.h Fri Dec 31 03:29:41 2010 +0100 @@ -40,7 +40,7 @@ @property (nonatomic,retain) UIWindow *secondWindow; +(SDLUIKitDelegate *)sharedAppDelegate; --(void) startSDLgame:(NSDictionary *)gameDictionary; +-(NSArray *)startSDLgame:(NSDictionary *)gameDictionary; -(void) displayOverlayLater:(id) object; @end diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m --- a/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SDL_uikitappdelegate.m Fri Dec 31 03:29:41 2010 +0100 @@ -85,7 +85,7 @@ } // main routine for calling the actual game engine --(void) startSDLgame:(NSDictionary *)gameDictionary { +-(NSArray *)startSDLgame:(NSDictionary *)gameDictionary { UIWindow *gameWindow; if (IS_DUALHEAD()) gameWindow = self.secondWindow; @@ -118,6 +118,7 @@ } [blackView release]; + // pull out useful configuration info from various files GameSetup *setup = [[GameSetup alloc] initWithDictionary:gameDictionary]; NSNumber *isNetGameNum = [gameDictionary objectForKey:@"netgame"]; @@ -126,23 +127,26 @@ toTarget:setup withObject:nil]; - const char **gameArgs = [setup getSettings:[gameDictionary objectForKey:@"savefile"]]; NSNumber *menuStyle = [NSNumber numberWithBool:setup.menuStyle]; - [setup release]; - - // since the sdlwindow is not yet created, we add the overlayController with a delay + NSNumber *orientation = [[gameDictionary objectForKey:@"game_dictionary"] objectForKey:@"orientation"]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: isNetGameNum,@"net", menuStyle,@"menu", - [[gameDictionary objectForKey:@"game_dictionary"] objectForKey:@"orientation"],@"orientation", + orientation,@"orientation", nil]; [self performSelector:@selector(displayOverlayLater:) withObject:dict afterDelay:1]; - // this is the pascal fuction that starts the game (wrapped around isInGame) + // need to set again [gameDictionary objectForKey:@"savefile"] because if it's empty it means it's a normal game + const char **gameArgs = [setup getGameSettings:[gameDictionary objectForKey:@"savefile"]]; self.isInGame = YES; + // this is the pascal fuction that starts the game Game(gameArgs); self.isInGame = NO; free(gameArgs); + + NSArray *stats = setup.statsArray; + [setup release]; + [self.uiwindow makeKeyAndVisible]; [self.uiwindow bringSubviewToFront:self.mainViewController.view]; @@ -156,9 +160,11 @@ [UIView commitAnimations]; [refBlackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:1]; [refSecondBlackView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:2]; + + return stats; } -// overlay with controls, become visible later, with a transparency effect +// overlay with controls, become visible later, with a transparency effect since the sdlwindow is not yet created -(void) displayOverlayLater:(id) object { NSDictionary *dict = (NSDictionary *)object; self.overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/SavedGamesViewController.m --- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Fri Dec 31 03:29:41 2010 +0100 @@ -21,6 +21,7 @@ #import "SavedGamesViewController.h" #import "SDL_uikitappdelegate.h" +#import "StatsPageViewController.h" #import "CommodityFunctions.h" @implementation SavedGamesViewController @@ -217,8 +218,23 @@ [NSNumber numberWithBool:NO],@"netgame", [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:self.interfaceOrientation] forKey:@"orientation"],@"game_dictionary", nil]; - [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; - [self.parentViewController dismissModalViewControllerAnimated:NO]; + + StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; + statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; + if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) + statsPage.modalPresentationStyle = UIModalPresentationPageSheet; + [self presentModalViewController:statsPage animated:NO]; + + NSArray *stats = [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; + if ([stats count] == 0) { + [statsPage dismissModalViewControllerAnimated:NO]; + } else { + statsPage.statsArray = stats; + [statsPage.tableView reloadData]; + [statsPage viewWillAppear:YES]; + } + // reload needed because when ending game the entry remains there + [self.tableView reloadData]; } #pragma mark - diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/StatsPageViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.h Fri Dec 31 03:29:41 2010 +0100 @@ -0,0 +1,30 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * 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 30/12/2010. + */ + + +#import + +@interface StatsPageViewController : UITableViewController { + NSArray *statsArray; +} + +@property (nonatomic,retain) NSArray *statsArray; + +@end \ No newline at end of file diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Classes/StatsPageViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Fri Dec 31 03:29:41 2010 +0100 @@ -0,0 +1,137 @@ +/* + * Hedgewars-iOS, a Hedgewars port for iOS devices + * Copyright (c) 2009-2010 Vittorio Giovara + * + * 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 30/12/2010. + */ + + +#import "StatsPageViewController.h" +#import "CommodityFunctions.h" + +@implementation StatsPageViewController +@synthesize statsArray; + +-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation { + return rotationManager(interfaceOrientation); +} + +-(void) viewDidLoad { + if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) + self.tableView.backgroundView = nil; + + NSString *imgName; + if (IS_IPAD()) + imgName = @"mediumBackground~ipad.png"; + else + imgName = @"smallerBackground~iphone.png"; + + if ([self.tableView respondsToSelector:@selector(setBackgroundView:)]) { + UIImage *backgroundImage = [[UIImage alloc] initWithContentsOfFile:imgName]; + UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage]; + [backgroundImage release]; + [self.tableView setBackgroundView:background]; + [background release]; + } else + self.view.backgroundColor = [UIColor blackColor]; + + self.tableView.separatorColor = UICOLOR_HW_YELLOW_BODER; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + + [super viewDidLoad]; +} + +#pragma mark - +#pragma mark Table view data source +-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { + return 3; +} + +-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 0 || section == 2) + return 1; + else + return [self.statsArray count] - 1; +} + +-(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *CellIdentifier0 = @"Cell0"; + NSInteger section = [indexPath section]; + NSInteger row = [indexPath row]; + + UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0]; + if (cell == nil) + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease]; + + cell.textLabel.textAlignment = UITextAlignmentCenter; + if (section == 0) { + cell.textLabel.text = [self.statsArray objectAtIndex:row]; + cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + } else if (section == 1) { + cell.textLabel.text = [self.statsArray objectAtIndex:row + 1]; + cell.textLabel.textColor = UICOLOR_HW_YELLOW_TEXT; + } else { + cell.textLabel.text = NSLocalizedString(@"Done",@""); + cell.textLabel.textColor = [UIColor whiteColor]; + } + cell.backgroundColor = [UIColor blackColor]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + return cell; +} + +-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 160; +} + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + if (section == 0) { + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 160)]; + UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"]; + UIImageView *imgView = [[UIImageView alloc] initWithImage:img]; + [img release]; + imgView.center = CGPointMake(self.tableView.frame.size.height/2, 160/2); + [header addSubview:imgView]; + [imgView release]; + + return [header autorelease]; + } else + return nil; +} + +#pragma mark - +#pragma mark Table view delegate +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([indexPath section] == 2) + [self dismissModalViewControllerAnimated:YES]; +} + +#pragma mark - +#pragma mark Memory management +-(void) didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + self.statsArray = nil; +} + +-(void) dealloc { + [statsArray release]; + [super dealloc]; +} + + +@end + diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj --- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Dec 31 01:05:23 2010 +0100 +++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Fri Dec 31 03:29:41 2010 +0100 @@ -118,6 +118,8 @@ 6172FEEF1298D25D00D73365 /* mediumBackground~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FEEB1298D25D00D73365 /* mediumBackground~ipad.png */; }; 6172FEF11298D25D00D73365 /* smallerBackground~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FEED1298D25D00D73365 /* smallerBackground~ipad.png */; }; 6172FEF21298D25D00D73365 /* smallerBackground~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 6172FEEE1298D25D00D73365 /* smallerBackground~iphone.png */; }; + 6174F7C812CD62E300205D6F /* smallerTitle.png in Resources */ = {isa = PBXBuildFile; fileRef = 6174F7C612CD62E300205D6F /* smallerTitle.png */; }; + 6174F7C912CD62E300205D6F /* smallerTitle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */; }; 61798816114AA34C00BA94A9 /* hwengine.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E7114AA34C00BA94A9 /* hwengine.pas */; }; 61798818114AA34C00BA94A9 /* hwLibrary.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987E9114AA34C00BA94A9 /* hwLibrary.pas */; }; 6179881B114AA34C00BA94A9 /* PascalExports.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987EC114AA34C00BA94A9 /* PascalExports.pas */; }; @@ -184,6 +186,7 @@ 61A670C212747DBD00B06CE7 /* MapConfigViewController-iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6165924E11CA9CB400D6E256 /* MapConfigViewController-iPhone.xib */; }; 61AC067412B2E32D000B52A2 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = 61AC067312B2E32D000B52A2 /* Appirater.m */; }; 61B3D71C11EA6F2700EC7420 /* uKeys.pas in Sources */ = {isa = PBXBuildFile; fileRef = 617987FE114AA34C00BA94A9 /* uKeys.pas */; }; + 61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B7A33712CC21080086B604 /* StatsPageViewController.m */; }; 61C079E411F35A300072BF46 /* EditableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 61C079E311F35A300072BF46 /* EditableCellView.m */; }; 61D205A1127CDD1100ABD83E /* ObjcExports.m in Sources */ = {isa = PBXBuildFile; fileRef = 61D205A0127CDD1100ABD83E /* ObjcExports.m */; }; 61D3D2A51290E03A003CE7C3 /* irc.png in Resources */ = {isa = PBXBuildFile; fileRef = 61D3D2A41290E03A003CE7C3 /* irc.png */; }; @@ -889,6 +892,8 @@ 6172FEEC1298D25D00D73365 /* smallerBackground@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "smallerBackground@2x~iphone.png"; path = "Resources/Frontend/smallerBackground@2x~iphone.png"; sourceTree = ""; }; 6172FEED1298D25D00D73365 /* smallerBackground~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "smallerBackground~ipad.png"; path = "Resources/Frontend/smallerBackground~ipad.png"; sourceTree = ""; }; 6172FEEE1298D25D00D73365 /* smallerBackground~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "smallerBackground~iphone.png"; path = "Resources/Frontend/smallerBackground~iphone.png"; sourceTree = ""; }; + 6174F7C612CD62E300205D6F /* smallerTitle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = smallerTitle.png; path = Resources/Frontend/smallerTitle.png; sourceTree = ""; }; + 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "smallerTitle@2x.png"; path = "Resources/Frontend/smallerTitle@2x.png"; sourceTree = ""; }; 617987E4114AA34C00BA94A9 /* GSHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = GSHandlers.inc; path = ../../hedgewars/GSHandlers.inc; sourceTree = SOURCE_ROOT; }; 617987E5114AA34C00BA94A9 /* HHHandlers.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = HHHandlers.inc; path = ../../hedgewars/HHHandlers.inc; sourceTree = SOURCE_ROOT; }; 617987E7114AA34C00BA94A9 /* hwengine.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = hwengine.pas; path = ../../hedgewars/hwengine.pas; sourceTree = SOURCE_ROOT; }; @@ -962,6 +967,8 @@ 61A4A3A112A5CD56004D81E6 /* uCaptions.pas */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; name = uCaptions.pas; path = ../../hedgewars/uCaptions.pas; sourceTree = SOURCE_ROOT; }; 61AC067212B2E32D000B52A2 /* Appirater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Appirater.h; path = Classes/Appirater.h; sourceTree = ""; }; 61AC067312B2E32D000B52A2 /* Appirater.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Appirater.m; path = Classes/Appirater.m; sourceTree = ""; }; + 61B7A33612CC21080086B604 /* StatsPageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsPageViewController.h; sourceTree = ""; }; + 61B7A33712CC21080086B604 /* StatsPageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsPageViewController.m; sourceTree = ""; }; 61C079E211F35A300072BF46 /* EditableCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditableCellView.h; path = Classes/EditableCellView.h; sourceTree = ""; }; 61C079E311F35A300072BF46 /* EditableCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EditableCellView.m; path = Classes/EditableCellView.m; sourceTree = ""; }; 61D2059F127CDD1100ABD83E /* ObjcExports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcExports.h; path = Classes/ObjcExports.h; sourceTree = ""; }; @@ -1154,6 +1161,8 @@ 611D9BF312497B7700008271 /* Other Controllers */ = { isa = PBXGroup; children = ( + 61B7A33612CC21080086B604 /* StatsPageViewController.h */, + 61B7A33712CC21080086B604 /* StatsPageViewController.m */, 61F2E7CB1205EDE0005734F7 /* AboutViewController.h */, 61F2E7CC1205EDE0005734F7 /* AboutViewController.m */, 61F2E7CD1205EDE0005734F7 /* AboutViewController.xib */, @@ -1494,6 +1503,8 @@ 61EBA62811DFF2BC0048B68A /* title.png */, 618899811299516000D55FD6 /* title@2x.png */, 61889984129995B500D55FD6 /* title~ipad.png */, + 6174F7C612CD62E300205D6F /* smallerTitle.png */, + 6174F7C712CD62E300205D6F /* smallerTitle@2x.png */, 61F9040A11DF59370068B24D /* background.png */, 6172FED61298CF9800D73365 /* background@2x~iphone.png */, 6172FED71298CF9800D73365 /* background~iphone.png */, @@ -2276,6 +2287,8 @@ 61188C0712A6FE960026C5DA /* settingsButton@2x.png in Resources */, 61188C0812A6FE9A0026C5DA /* title@2x.png in Resources */, 61188C0912A6FE9C0026C5DA /* tw@2x.png in Resources */, + 6174F7C812CD62E300205D6F /* smallerTitle.png in Resources */, + 6174F7C912CD62E300205D6F /* smallerTitle@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2424,6 +2437,7 @@ 61F544C712AF1748007FD913 /* HoldTableViewCell.m in Sources */, 61AC067412B2E32D000B52A2 /* Appirater.m in Sources */, 61E2E12E12BAAEE30051B659 /* ServerSetup.m in Sources */, + 61B7A33812CC21080086B604 /* StatsPageViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Resources/Frontend/smallerTitle.png Binary file project_files/HedgewarsMobile/Resources/Frontend/smallerTitle.png has changed diff -r 68f9b331014a -r 5ea3d182415e project_files/HedgewarsMobile/Resources/Frontend/smallerTitle@2x.png Binary file project_files/HedgewarsMobile/Resources/Frontend/smallerTitle@2x.png has changed