--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Thu Nov 03 01:10:25 2011 +0100
@@ -210,7 +210,7 @@
script = self.schemeWeaponConfigViewController.scriptCommand;
// create the configuration file that is going to be sent to engine
- NSDictionary *gameDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
+ NSDictionary *gameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
self.mapConfigViewController.seedCommand,@"seed_command",
self.mapConfigViewController.templateFilterCommand,@"templatefilter_command",
self.mapConfigViewController.mapGenCommand,@"mapgen_command",
@@ -223,9 +223,8 @@
script,@"mission_command",
nil];
- GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
- [bridge startLocalGame:gameDictionary];
- [bridge release];
+ [GameInterfaceBridge startLocalGame:gameDictionary];
+ [gameDictionary release];
}
-(void) loadNiceHogs {
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Thu Nov 03 01:10:25 2011 +0100
@@ -26,10 +26,8 @@
}
-
--(id) initWithController:(id) viewController;
--(void) startLocalGame:(NSDictionary *)withOptions;
--(void) startSaveGame:(NSString *)atPath;
--(void) startMissionGame:(NSString *)withScript;
++(void) startLocalGame:(NSDictionary *)withOptions;
++(void) startSaveGame:(NSString *)atPath;
++(void) startMissionGame:(NSString *)withScript;
@end
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Thu Nov 03 01:10:25 2011 +0100
@@ -28,19 +28,8 @@
@implementation GameInterfaceBridge
--(id) initWithController:(id) viewController {
- if (self = [super init]) {
- }
- return self;
-}
-
--(void) dealloc {
- [super dealloc];
-}
-
-#pragma mark -
// main routine for calling the actual game engine
--(void) engineLaunchOn:(NSInteger) ipcPort withArgument:(NSString *)path {
++(void) engineLaunchOn:(NSInteger) ipcPort withArgument:(NSString *)path {
const char *gameArgs[11];
CGFloat width, height;
CGFloat screenScale = [[UIScreen mainScreen] safeScale];
@@ -107,7 +96,7 @@
}
// prepares the controllers for hosting a game
--(void) prepareEngineOn:(NSString *)pathOrNil withOptions:(NSDictionary *)optionsOrNil {
++(void) prepareEngineOn:(NSString *)pathOrNil withOptions:(NSDictionary *)optionsOrNil {
EngineProtocolNetwork *proto = [[EngineProtocolNetwork alloc] init];
NSInteger ipcPort = [proto spawnThread:pathOrNil withOptions:optionsOrNil];
@@ -160,7 +149,7 @@
}
// set up variables for a local game
--(void) startLocalGame:(NSDictionary *)withOptions {
++(void) startLocalGame:(NSDictionary *)withOptions {
[HWUtils setGameType:gtLocal];
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
@@ -172,24 +161,24 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:savePath])
[[NSFileManager defaultManager] removeItemAtPath:savePath error:nil];
- [self prepareEngineOn:savePath withOptions:withOptions];
+ [GameInterfaceBridge prepareEngineOn:savePath withOptions:withOptions];
[savePath release];
}
// set up variables for a save game
--(void) startSaveGame:(NSString *)atPath {
++(void) startSaveGame:(NSString *)atPath {
[HWUtils setGameType:gtSave];
- [self prepareEngineOn:atPath withOptions:nil];
+ [GameInterfaceBridge prepareEngineOn:atPath withOptions:nil];
}
--(void) startMissionGame:(NSString *)withScript {
++(void) startMissionGame:(NSString *)withScript {
[HWUtils setGameType:gtMission];
NSString *missionPath = [[NSString alloc] initWithFormat:@"escript Missions/Training/%@.lua",withScript];
NSDictionary *missionLine = [[NSDictionary alloc] initWithObjectsAndKeys:missionPath,@"mission_command",nil];
[missionPath release];
- [self prepareEngineOn:nil withOptions:missionLine];
+ [GameInterfaceBridge prepareEngineOn:nil withOptions:missionLine];
[missionLine release];
}
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Thu Nov 03 01:10:25 2011 +0100
@@ -234,9 +234,7 @@
#pragma mark -
-(void) launchRestoredGame {
[[NSNotificationCenter defaultCenter] removeObserver:self];
- GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
- [bridge startSaveGame:[[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"]];
- [bridge release];
+ [GameInterfaceBridge startSaveGame:[[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"]];
}
#pragma mark -
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Thu Nov 03 01:10:25 2011 +0100
@@ -74,9 +74,7 @@
[AudioManagerController playBackSound];
[[self parentViewController] dismissModalViewControllerAnimated:YES];
} else {
- GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
- [bridge startMissionGame:self.missionName];
- [bridge release];
+ [GameInterfaceBridge startMissionGame:self.missionName];
}
}
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Thu Nov 03 01:10:25 2011 +0100
@@ -22,19 +22,16 @@
#import <UIKit/UIKit.h>
#import "EditableCellView.h"
-@class GameInterfaceBridge;
@interface SavedGamesViewController : UIViewController <UITableViewDelegate, UITableViewDataSource,
EditableCellViewDelegate, UIActionSheetDelegate> {
UITableView *tableView;
NSMutableArray *listOfSavegames;
NSInteger numberOfItems;
- GameInterfaceBridge *interfaceBridge;
}
@property (nonatomic,retain) IBOutlet UITableView *tableView;
@property (nonatomic,retain) NSMutableArray *listOfSavegames;
-@property (nonatomic,retain) GameInterfaceBridge *interfaceBridge;
@property (assign) NSInteger numberOfItems;
-(IBAction) buttonPressed:(id) sender;
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Thu Nov 03 00:56:44 2011 +0100
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Thu Nov 03 01:10:25 2011 +0100
@@ -24,7 +24,7 @@
@implementation SavedGamesViewController
-@synthesize tableView, listOfSavegames, interfaceBridge, numberOfItems;
+@synthesize tableView, listOfSavegames, numberOfItems;
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
return rotationManager(interfaceOrientation);
@@ -189,13 +189,7 @@
self.numberOfItems++;
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
- if (self.interfaceBridge == nil) {
- GameInterfaceBridge *bridge = [[GameInterfaceBridge alloc] initWithController:self];
- self.interfaceBridge = bridge;
- [bridge release];
- }
-
- [self.interfaceBridge startSaveGame:currentFilePath];
+ [GameInterfaceBridge startSaveGame:currentFilePath];
[currentFilePath release];
}
@@ -219,8 +213,6 @@
#pragma mark Memory Management
-(void) didReceiveMemoryWarning {
self.listOfSavegames = nil;
- // don't nil this one or it won't be able to send messages
- //self.interfaceBridge = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
@@ -228,7 +220,6 @@
-(void) viewDidUnload {
self.tableView = nil;
self.listOfSavegames = nil;
- self.interfaceBridge = nil;
MSG_DIDUNLOAD();
[super viewDidUnload];
}
@@ -236,7 +227,6 @@
-(void) dealloc {
releaseAndNil(tableView);
releaseAndNil(listOfSavegames);
- releaseAndNil(interfaceBridge);
[super dealloc];
}