--- a/hedgewars/uInputHandler.pas Wed Jan 17 00:59:39 2018 +0100
+++ b/hedgewars/uInputHandler.pas Sun Mar 11 20:43:15 2018 +0100
@@ -421,7 +421,7 @@
var j: Integer;
begin
ControllerEnabled:= 0;
-{$IFDEF IPHONE}
+{$IFDEF IPHONEOS}
exit; // joystick subsystem disabled on iPhone
{$ENDIF}
--- a/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Wed Jan 17 00:59:39 2018 +0100
+++ b/misc/liblua/Xcode/Lua.xcodeproj/project.pbxproj Sun Mar 11 20:43:15 2018 +0100
@@ -397,6 +397,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
@@ -430,6 +431,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_FAST_MATH = YES;
--- a/misc/liblua/loslib.c Wed Jan 17 00:59:39 2018 +0100
+++ b/misc/liblua/loslib.c Sun Mar 11 20:43:15 2018 +0100
@@ -19,6 +19,17 @@
#include "lauxlib.h"
#include "lualib.h"
+#if ((defined __MACH__) && (defined __APPLE__))
+ #include <TargetConditionals.h>
+ #if TARGET_OS_IPHONE
+ #define LUA_PLATFORM_IOS 1
+ #endif
+#endif
+
+#ifdef LUA_PLATFORM_IOS
+ #include <spawn.h>
+ extern char **environ;
+#endif
static int os_pushresult (lua_State *L, int i, const char *filename) {
int en = errno; /* calls to Lua API may change this value */
@@ -36,7 +47,18 @@
static int os_execute (lua_State *L) {
- lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));
+ const char *command = luaL_optstring(L, 1, NULL);
+ int status;
+#ifndef LUA_PLATFORM_IOS
+ status = system(command);
+#else
+ // untested, may require adjustments depending on `command`
+ pid_t pid;
+ char *argv[] = { (char *)command, NULL };
+ posix_spawn(&pid, argv[0], NULL, NULL, argv, environ);
+ waitpid(pid, &status, 0);
+#endif
+ lua_pushinteger(L, status);
return 1;
}
--- a/misc/libphysfs/Xcode/Physfs.xcodeproj/project.pbxproj Wed Jan 17 00:59:39 2018 +0100
+++ b/misc/libphysfs/Xcode/Physfs.xcodeproj/project.pbxproj Sun Mar 11 20:43:15 2018 +0100
@@ -272,6 +272,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
@@ -309,6 +310,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
--- a/misc/libphyslayer/Xcode/Physlayer.xcodeproj/project.pbxproj Wed Jan 17 00:59:39 2018 +0100
+++ b/misc/libphyslayer/Xcode/Physlayer.xcodeproj/project.pbxproj Sun Mar 11 20:43:15 2018 +0100
@@ -203,6 +203,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
@@ -220,6 +221,7 @@
"\"$(SRCROOT)/../../liblua\"",
"\"$(SRCROOT)/../../../../Library/SDL/include\"",
);
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PREBINDING = NO;
@@ -238,6 +240,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
@@ -253,6 +256,7 @@
"\"$(SRCROOT)/../../liblua\"",
"\"$(SRCROOT)/../../../../Library/SDL/include\"",
);
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
OTHER_LDFLAGS = "-ObjC";
PREBINDING = NO;
SDKROOT = iphoneos;
--- a/project_files/HedgewarsMobile/Classes/AboutViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/AboutViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -26,11 +26,11 @@
NSArray *people;
}
-@property (nonatomic,retain) IBOutlet UITableView *tableView;
-@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;
-@property (nonatomic,retain) NSArray *people;
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet UISegmentedControl *segmentedControl;
+@property (nonatomic, strong) NSArray *people;
--(IBAction) buttonPressed:(id) sender;
--(IBAction) segmentedControlChanged:(id) sender;
+- (IBAction)buttonPressed:(id)sender;
+- (IBAction)segmentedControlChanged:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/AboutViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/AboutViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,11 +23,11 @@
@implementation AboutViewController
@synthesize tableView, segmentedControl, people;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(void) viewDidLoad
+- (void)viewDidLoad
{
[super viewDidLoad];
@@ -36,7 +36,6 @@
NSArray *array = [[NSArray alloc] initWithContentsOfFile:CREDITS_FILE()];
self.people = array;
- [array release];
NSString *imgName;
if (IS_IPAD())
@@ -45,16 +44,14 @@
imgName = @"smallerBackground~iphone.png";
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
UIImageView *background = [[UIImageView alloc] initWithImage:img];
- [img release];
background.frame = self.view.frame;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:background atIndex:0];
- [background release];
[self localizeSegmentedControl];
}
--(IBAction) buttonPressed:(id) sender {
+- (IBAction)buttonPressed:(id)sender {
[[AudioManagerController mainManager] playBackSound];
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
@@ -70,7 +67,7 @@
}
}
--(IBAction) segmentedControlChanged:(id) sender {
+- (IBAction)segmentedControlChanged:(id)sender {
[[AudioManagerController mainManager] playClickSound];
[self.tableView setContentOffset:CGPointMake(0, 0) animated:NO];
[self.tableView reloadData];
@@ -91,7 +88,7 @@
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
// first all the names, then the title (which is offset 5)
cell.textLabel.text = [[self.people objectAtIndex:self.segmentedControl.selectedSegmentIndex] objectAtIndex:[indexPath row]];
@@ -105,7 +102,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// do nothing
}
@@ -113,7 +110,7 @@
return 95;
}
--(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
char *fullver;
int proto;
@@ -133,33 +130,18 @@
label.textColor = [UIColor lightGrayColor];
label.numberOfLines = 5;
label.text = footerString;
- [footerString release];
label.backgroundColor = [UIColor clearColor];
[footer addSubview:label];
- [label release];
- return [footer autorelease];
+ return footer;
}
#pragma mark -
#pragma mark Memory Management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.people = nil;
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.tableView = nil;
- self.segmentedControl = nil;
- self.people = nil;
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(tableView);
- releaseAndNil(segmentedControl);
- releaseAndNil(people);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/AudioManagerController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/AudioManagerController.h Sun Mar 11 20:43:15 2018 +0100
@@ -33,26 +33,26 @@
NSOperationQueue *audioFaderQueue;
}
-@property (nonatomic,retain) AVAudioPlayer *backgroundMusic;
+@property (nonatomic, strong) AVAudioPlayer *backgroundMusic;
@property (assign) SystemSoundID clickSound;
@property (assign) SystemSoundID backSound;
@property (assign) SystemSoundID selSound;
-@property (nonatomic,retain) NSOperationQueue *audioFaderQueue;
+@property (nonatomic, strong) NSOperationQueue *audioFaderQueue;
+(id) mainManager;
--(void) playBackgroundMusic;
--(void) pauseBackgroundMusic;
--(void) stopBackgroundMusic;
+- (void)playBackgroundMusic;
+- (void)pauseBackgroundMusic;
+- (void)stopBackgroundMusic;
--(void) fadeInBackgroundMusic;
--(void) fadeOutBackgroundMusic;
+- (void)fadeInBackgroundMusic;
+- (void)fadeOutBackgroundMusic;
--(void) playClickSound;
--(void) playBackSound;
--(void) playSelectSound;
+- (void)playClickSound;
+- (void)playBackSound;
+- (void)playSelectSound;
-(SystemSoundID) loadSound:(NSString *)snd;
--(void) unloadSounds;
+- (void)unloadSounds;
@end
--- a/project_files/HedgewarsMobile/Classes/AudioManagerController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/AudioManagerController.m Sun Mar 11 20:43:15 2018 +0100
@@ -37,7 +37,7 @@
return mainInstance;
}
--(id) init {
+- (id)init {
if ((self = [super init])) {
self.backgroundMusic = nil;
self.clickSound = -1;
@@ -49,15 +49,12 @@
return self;
}
--(void) dealloc {
+- (void)dealloc {
[self unloadSounds];
- releaseAndNil(backgroundMusic);
- releaseAndNil(audioFaderQueue);
mainInstance = nil;
- [super dealloc];
}
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
if (self.backgroundMusic.playing == NO)
self.backgroundMusic = nil;
if ([self.audioFaderQueue operationCount] == 0)
@@ -69,7 +66,7 @@
#pragma mark -
#pragma mark background music control
--(void) playBackgroundMusic {
+- (void)playBackgroundMusic {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"music"] boolValue] == NO)
return;
@@ -84,15 +81,15 @@
[self.backgroundMusic play];
}
--(void) pauseBackgroundMusic {
+- (void)pauseBackgroundMusic {
[self.backgroundMusic pause];
}
--(void) stopBackgroundMusic {
+- (void)stopBackgroundMusic {
[self.backgroundMusic stop];
}
--(void) fadeOutBackgroundMusic {
+- (void)fadeOutBackgroundMusic {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"music"] boolValue] == NO)
return;
@@ -103,10 +100,9 @@
toVolume:0.0
overDuration:FADEOUT_DURATION];
[self.audioFaderQueue addOperation:fadeOut];
- [fadeOut release];
}
--(void) fadeInBackgroundMusic {
+- (void)fadeInBackgroundMusic {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"music"] boolValue] == NO)
return;
@@ -118,7 +114,6 @@
toVolume:DEFAULT_VOLUME
overDuration:FADEIN_DURATION];
[audioFaderQueue addOperation:fadeIn];
- [fadeIn release];
}
#pragma mark -
@@ -131,17 +126,17 @@
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
// use audio sevices to create and play the sound
- AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
+ AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
return soundID;
}
--(void) unloadSounds {
+- (void)unloadSounds {
AudioServicesDisposeSystemSoundID(clickSound), clickSound = -1;
AudioServicesDisposeSystemSoundID(backSound), backSound = -1;
AudioServicesDisposeSystemSoundID(selSound), selSound = -1;
}
--(void) playClickSound {
+- (void)playClickSound {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"sound"] boolValue] == NO)
return;
@@ -151,7 +146,7 @@
AudioServicesPlaySystemSound(self.clickSound);
}
--(void) playBackSound {
+- (void)playBackSound {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"sound"] boolValue] == NO)
return;
@@ -161,7 +156,7 @@
AudioServicesPlaySystemSound(self.backSound);
}
--(void) playSelectSound {
+- (void)playSelectSound {
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"sound"] boolValue] == NO)
return;
--- a/project_files/HedgewarsMobile/Classes/CampaignViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/CampaignViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -20,6 +20,6 @@
@interface CampaignViewController : UITableViewController
-@property (nonatomic, retain) NSString *campaignName;
+@property (nonatomic, strong) NSString *campaignName;
@end
--- a/project_files/HedgewarsMobile/Classes/CampaignViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/CampaignViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -21,7 +21,7 @@
#import "GameInterfaceBridge.h"
@interface CampaignViewController ()
-@property (nonatomic, retain) NSArray *campaignMissions;
+@property (nonatomic, strong) NSArray *campaignMissions;
@end
@implementation CampaignViewController
@@ -40,7 +40,6 @@
IniParser *iniParser = [[IniParser alloc] initWithIniFilePath:campaignIniPath];
NSArray *parsedMissions = [iniParser newParsedSections];
- [iniParser release];
return parsedMissions;
}
@@ -52,7 +51,6 @@
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)];
self.navigationItem.rightBarButtonItem = doneButton;
- [doneButton release];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"campaignMissionCell"];
}
@@ -95,10 +93,5 @@
#pragma mark - Dealloc
-- (void)dealloc {
- [_campaignName release];
- [_campaignMissions release];
- [super dealloc];
-}
@end
--- a/project_files/HedgewarsMobile/Classes/CampaignsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/CampaignsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -20,7 +20,7 @@
#import "CampaignViewController.h"
@interface CampaignsViewController ()
-@property (nonatomic, retain) NSArray *campaigns;
+@property (nonatomic, strong) NSArray *campaigns;
@end
@implementation CampaignsViewController
@@ -48,7 +48,6 @@
}
NSArray *campaigns = [tempCampaigns copy];
- [tempCampaigns release];
return campaigns;
}
@@ -59,7 +58,6 @@
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismiss)];
self.navigationItem.rightBarButtonItem = doneButton;
- [doneButton release];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"campaignCell"];
}
@@ -100,14 +98,9 @@
campaign.campaignName = self.campaigns[indexPath.row];
[self.navigationController pushViewController:campaign animated:YES];
- [campaign release];
}
#pragma mark - Dealloc
-- (void)dealloc {
- [_campaigns release];
- [super dealloc];
-}
@end
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,18 +24,18 @@
}
-+(void) createFirstLaunch;
-+(void) createSettings;
++ (void)createFirstLaunch;
++ (void)createSettings;
-+(void) createTeamNamed:(NSString *)nameWithoutExt;
-+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type;
-+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type controlledByAI:(BOOL) shouldAITakeOver;
++ (void)createTeamNamed:(NSString *)nameWithoutExt;
++ (void)createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type;
++ (void)createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type controlledByAI:(BOOL) shouldAITakeOver;
-+(void) createWeaponNamed:(NSString *)nameWithoutExt;
-+(void) createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type;
++ (void)createWeaponNamed:(NSString *)nameWithoutExt;
++ (void)createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type;
-+(void) createSchemeNamed:(NSString *)nameWithoutExt;
-+(void) createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type;
++ (void)createSchemeNamed:(NSString *)nameWithoutExt;
++ (void)createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type;
@end
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,7 +23,7 @@
@implementation CreationChamber
#pragma mark Checking status
-+(void) createFirstLaunch {
++ (void)createFirstLaunch {
DLog(@"Creating necessary files");
NSInteger index;
@@ -50,7 +50,6 @@
index = 0;
for (NSString *name in teamNames)
[self createTeamNamed:name ofType:index++ controlledByAI:[name isEqualToString:@"Robots"]];
- [teamNames release];
// SCHEMES - always overwrite and delete custom ones
if ([[NSFileManager defaultManager] fileExistsAtPath:SCHEMES_DIRECTORY()] == YES)
@@ -61,7 +60,6 @@
index = 0;
for (NSString *name in schemeNames)
[self createSchemeNamed:name ofType:index++];
- [schemeNames release];
// WEAPONS - always overwrite as merge is not needed (missing weaps are 0ed automatically)
NSArray *weaponNames = [[NSArray alloc] initWithObjects:@"Default",@"Crazy",@"Pro Mode",@"Shoppa",@"Clean Slate",
@@ -69,11 +67,10 @@
index = 0;
for (NSString *name in weaponNames)
[self createWeaponNamed:name ofType:index++];
- [weaponNames release];
}
#pragma mark Settings
-+(void) createSettings {
++ (void)createSettings {
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
[settings setObject:[NSNumber numberWithBool:NO] forKey:@"alternate"];
[settings setObject:[NSNumber numberWithBool:YES] forKey:@"music"];
@@ -90,15 +87,15 @@
}
#pragma mark Teams
-+(void) createTeamNamed:(NSString *)nameWithoutExt {
++ (void)createTeamNamed:(NSString *)nameWithoutExt {
[self createTeamNamed:nameWithoutExt ofType:0 controlledByAI:NO];
}
-+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type {
++ (void)createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type {
[self createTeamNamed:nameWithoutExt ofType:type controlledByAI:NO];
}
-+(void) createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type controlledByAI:(BOOL) shouldAITakeOver {
++ (void)createTeamNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type controlledByAI:(BOOL) shouldAITakeOver {
NSString *teamsDirectory = TEAMS_DIRECTORY();
if (![[NSFileManager defaultManager] fileExistsAtPath: teamsDirectory]) {
@@ -159,10 +156,7 @@
[customHats objectAtIndex:i],@"hat",
nil];
[hedgehogs addObject:hog];
- [hog release];
}
- [customHats release];
- [customNames release];
NSDictionary *theTeam = [[NSDictionary alloc] initWithObjectsAndKeys:
@"0",@"hash",
@@ -172,21 +166,18 @@
flag,@"flag",
hedgehogs,@"hedgehogs",
nil];
- [hedgehogs release];
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", teamsDirectory, nameWithoutExt];
[theTeam writeToFile:teamFile atomically:YES];
- [teamFile release];
- [theTeam release];
}
#pragma mark Weapons
-+(void) createWeaponNamed:(NSString *)nameWithoutExt {
++ (void)createWeaponNamed:(NSString *)nameWithoutExt {
[self createWeaponNamed:nameWithoutExt ofType:0];
}
-+(void) createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type {
++ (void)createWeaponNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type {
NSString *weaponsDirectory = WEAPONS_DIRECTORY();
if (![[NSFileManager defaultManager] fileExistsAtPath: weaponsDirectory]) {
@@ -269,23 +260,17 @@
NSDictionary *theWeapon = [[NSDictionary alloc] initWithObjectsAndKeys: qt,@"ammostore_initialqt",
prob,@"ammostore_probability", delay,@"ammostore_delay", crate,@"ammostore_crate", nil];
- [qt release];
- [prob release];
- [delay release];
- [crate release];
NSString *weaponFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", weaponsDirectory, nameWithoutExt];
[theWeapon writeToFile:weaponFile atomically:YES];
- [weaponFile release];
- [theWeapon release];
}
#pragma mark Schemes
-+(void) createSchemeNamed:(NSString *)nameWithoutExt {
++ (void)createSchemeNamed:(NSString *)nameWithoutExt {
[self createSchemeNamed:nameWithoutExt ofType:0];
}
-+(void) createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger) type {
++ (void)createSchemeNamed:(NSString *)nameWithoutExt ofType:(NSInteger)type {
NSString *schemesDirectory = SCHEMES_DIRECTORY();
if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
@@ -300,13 +285,11 @@
NSMutableArray *basicArray = [[NSMutableArray alloc] initWithCapacity:[basicSettings count]];
for (NSDictionary *basicDict in basicSettings)
[basicArray addObject:[basicDict objectForKey:@"default"]];
- [basicSettings release];
NSArray *mods = [[NSArray alloc] initWithContentsOfFile:GAMEMODS_FILE()];
NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]];
for (NSUInteger i = 0; i < [mods count]; i++)
[gamemodArray addObject:[NSNumber numberWithBool:NO]];
- [mods release];
switch (type) {
default: // default
@@ -422,14 +405,10 @@
basicArray,@"basic",
gamemodArray,@"gamemod",
nil];
- [gamemodArray release];
- [basicArray release];
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist", schemesDirectory, nameWithoutExt];
[theScheme writeToFile:schemeFile atomically:YES];
- [schemeFile release];
- [theScheme release];
}
@end
--- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,14 +24,11 @@
#ifdef DEBUG
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
- #define releaseAndNil(x) [x release]
#else
- #define DLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
- #define releaseAndNil(x) [x release], x = nil
#endif
--- a/project_files/HedgewarsMobile/Classes/EditableCellView.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/EditableCellView.h Sun Mar 11 20:43:15 2018 +0100
@@ -22,12 +22,12 @@
@protocol EditableCellViewDelegate <NSObject>
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue;
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue;
@end
@interface EditableCellView : UITableViewCell <UITextFieldDelegate> {
- id<EditableCellViewDelegate> delegate;
+ id<EditableCellViewDelegate> __weak delegate;
UITextField *textField;
UILabel *titleLabel;
NSUInteger minimumCharacters;
@@ -38,16 +38,16 @@
NSString *oldValue;
}
-@property (nonatomic,assign) id<EditableCellViewDelegate> delegate;
-@property (nonatomic,retain,readonly) UITextField *textField;
-@property (nonatomic,retain,readonly) UILabel *titleLabel;
-@property (nonatomic,assign) NSUInteger minimumCharacters;
-@property (nonatomic,assign) NSUInteger maximumCharacters;
-@property (nonatomic,assign) BOOL respectEditing;
-@property (nonatomic,retain) NSString *oldValue;
+@property (nonatomic, weak) id<EditableCellViewDelegate> delegate;
+@property (nonatomic, strong, readonly) UITextField *textField;
+@property (nonatomic, strong, readonly) UILabel *titleLabel;
+@property (assign) NSUInteger minimumCharacters;
+@property (assign) NSUInteger maximumCharacters;
+@property (assign) BOOL respectEditing;
+@property (nonatomic, strong) NSString *oldValue;
--(void) replyKeyboard;
--(void) cancel:(id) sender;
--(void) save:(id) sender;
+- (void)replyKeyboard;
+- (void)cancel:(id)sender;
+- (void)save:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,7 +23,7 @@
@implementation EditableCellView
@synthesize delegate, textField, titleLabel, minimumCharacters, maximumCharacters, respectEditing, oldValue;
--(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
delegate = nil;
@@ -40,14 +40,12 @@
[textField addTarget:self action:@selector(save:) forControlEvents:UIControlEventEditingDidEndOnExit];
[self.contentView addSubview:textField];
- //[textField release];
titleLabel = [[UILabel alloc] init];
titleLabel.textAlignment = NSTextAlignmentLeft;
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
[self.contentView addSubview:titleLabel];
- //[titleLabel release];
minimumCharacters = 1;
maximumCharacters = 64;
@@ -57,7 +55,7 @@
return self;
}
--(void) layoutSubviews {
+- (void)layoutSubviews {
[super layoutSubviews];
CGRect contentRect = self.contentView.bounds;
@@ -79,35 +77,27 @@
textField.frame = CGRectMake(boundsX+offset+10, skew+10, 300, [UIFont labelFontSize] + 4);
}
--(void) setSelected:(BOOL)selected animated:(BOOL)animated {
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
--(void) dealloc {
- self.delegate = nil;
- releaseAndNil(oldValue);
- releaseAndNil(titleLabel);
- releaseAndNil(textField);
- [super dealloc];
-}
-
#pragma mark -
#pragma mark textField delegate
// limit the size of the field to 64 characters like in original frontend
--(BOOL) textField:(UITextField *)aTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+- (BOOL)textField:(UITextField *)aTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
return !([aTextField.text length] > self.maximumCharacters && [string length] > range.length);
}
// allow editing only if delegate is set and conformant to protocol, and if editableOnlyWhileEditing
--(BOOL) textFieldShouldBeginEditing:(UITextField *)aTextField {
+- (BOOL)textFieldShouldBeginEditing:(UITextField *)aTextField {
return (delegate != nil) &&
[delegate respondsToSelector:@selector(saveTextFieldValue:withTag:)] &&
(respectEditing) ? [self findTable].editing : YES;
}
// the textfield is being modified, update the navigation controller
--(void) textFieldDidBeginEditing:(UITextField *)aTextField{
+- (void)textFieldDidBeginEditing:(UITextField *)aTextField{
// don't interact with table below
[self findTable].scrollEnabled = NO;
@@ -118,30 +108,28 @@
target:self
action:@selector(cancel:)];
[(UITableViewController *)delegate navigationItem].leftBarButtonItem = cancelButton;
- [cancelButton release];
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Save",@"")
style:UIBarButtonItemStyleDone
target:self
action:@selector(save:)];
[(UITableViewController *)delegate navigationItem].rightBarButtonItem = saveButton;
- [saveButton release];
}
/* with this a field might remain in editing status even if the view moved;
use method below instead that allows some more interaction
// don't accept 0-length strings
--(BOOL) textFieldShouldEndEditing:(UITextField *)aTextField {
+- (BOOL)textFieldShouldEndEditing:(UITextField *)aTextField {
return ([aTextField.text length] > 0);
}
*/
--(BOOL) textFieldShouldReturn:(UITextField *)aTextField {
+- (BOOL)textFieldShouldReturn:(UITextField *)aTextField {
return ([aTextField.text length] >= self.minimumCharacters);
}
// the textfield has been modified, tell the delegate to do something
--(void) textFieldDidEndEditing:(UITextField *)aTextField {
+- (void)textFieldDidEndEditing:(UITextField *)aTextField {
// this forces a save when user selects a new field
if ([self.textField.text isEqualToString:self.oldValue] == NO)
[self save:aTextField];
@@ -155,19 +143,19 @@
#pragma mark -
#pragma mark instance methods
// the user wants to show the keyboard
--(void) replyKeyboard {
+- (void)replyKeyboard {
[self.textField becomeFirstResponder];
}
// the user pressed cancel so hide keyboard
--(void) cancel:(id) sender {
+- (void)cancel:(id)sender {
// reverts any changes and performs a fake save for removing the keyboard
self.textField.text = self.oldValue;
[self save:sender];
}
// send the value to the delegate (called before textFieldDidEndEditing)
--(void) save:(id) sender {
+- (void)save:(id)sender {
if (delegate == nil || [delegate respondsToSelector:@selector(saveTextFieldValue:withTag:)] == NO)
return;
@@ -181,7 +169,7 @@
}
// when field is editable only when the tableview is editable, resign responder when exiting editing mode
--(void) willTransitionToState:(UITableViewCellStateMask)state {
+- (void)willTransitionToState:(UITableViewCellStateMask)state {
if (respectEditing && state == UITableViewCellStateDefaultMask)
[self save:nil];
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.h Sun Mar 11 20:43:15 2018 +0100
@@ -23,32 +23,32 @@
@protocol EngineProtocolDelegate <NSObject>
--(void) gameEndedWithStatistics:(NSArray *)stats;
+- (void)gameEndedWithStatistics:(NSArray *)stats;
@end
@interface EngineProtocolNetwork : NSObject {
- id<EngineProtocolDelegate> delegate;
+ id<EngineProtocolDelegate> __weak delegate;
NSOutputStream *stream;
TCPsocket csd;
NSInteger enginePort;
}
-@property (nonatomic,assign) id<EngineProtocolDelegate> delegate;
-@property (nonatomic,retain) NSOutputStream *stream;
+@property (nonatomic, weak) id<EngineProtocolDelegate> delegate;
+@property (nonatomic, strong) NSOutputStream *stream;
@property (assign) TCPsocket csd;
@property (assign) NSInteger enginePort;
--(id) init;
--(id) initWithPort:(NSInteger) port;
--(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary;
--(void) engineProtocol:(id) object;
+- (id) init;
+- (id) initWithPort:(NSInteger)port;
+- (void)spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary;
+- (void)engineProtocol:(id)object;
-(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;
+- (void)provideTeamData:(NSString *)teamName forHogs:(NSInteger)numberOfPlayingHogs withHealth:(NSInteger)initialHealth ofColor:(NSNumber *)teamColor;
+- (void)provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger)numberOfTeams;
+- (NSInteger)provideScheme:(NSString *)schemeName;
@end
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Sun Mar 11 20:43:15 2018 +0100
@@ -25,7 +25,7 @@
@implementation EngineProtocolNetwork
@synthesize delegate, stream, csd, enginePort;
--(id) initWithPort:(NSInteger) port {
+- (id)initWithPort:(NSInteger)port {
if ((self = [super init])) {
self.delegate = nil;
self.csd = NULL;
@@ -35,19 +35,13 @@
return self;
}
--(id) init {
+- (id)init {
return [self initWithPort:[HWUtils randomPort]];
}
--(void) dealloc {
- self.delegate = nil;
- releaseAndNil(stream);
- [super dealloc];
-}
-
#pragma mark -
#pragma mark Spawner functions
--(void) spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary {
+- (void)spawnThread:(NSString *)onSaveFile withOptions:(NSDictionary *)dictionary {
self.stream = (onSaveFile) ? [[NSOutputStream alloc] initToFileAtPath:onSaveFile append:YES] : nil;
[self.stream open];
@@ -60,7 +54,7 @@
#pragma mark -
#pragma mark Provider functions
// unpacks team data from the selected team.plist to a sequence of engine commands
--(void) provideTeamData:(NSString *)teamName forHogs:(NSInteger) numberOfPlayingHogs withHealth:(NSInteger) initialHealth ofColor:(NSNumber *)teamColor {
+- (void)provideTeamData:(NSString *)teamName forHogs:(NSInteger)numberOfPlayingHogs withHealth:(NSInteger)initialHealth ofColor:(NSNumber *)teamColor {
/*
addteam <32charsMD5hash> <color> <team name>
addhh <level> <health> <hedgehog name>
@@ -69,28 +63,22 @@
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@", TEAMS_DIRECTORY(), teamName];
NSDictionary *teamData = [[NSDictionary alloc] initWithContentsOfFile:teamFile];
- [teamFile release];
NSString *teamHashColorAndName = [[NSString alloc] initWithFormat:@"eaddteam %@ %@ %@",
[teamData objectForKey:@"hash"], [teamColor stringValue], [teamName stringByDeletingPathExtension]];
[self sendToEngine: teamHashColorAndName];
- [teamHashColorAndName release];
NSString *grave = [[NSString alloc] initWithFormat:@"egrave %@", [teamData objectForKey:@"grave"]];
[self sendToEngine: grave];
- [grave release];
NSString *fort = [[NSString alloc] initWithFormat:@"efort %@", [teamData objectForKey:@"fort"]];
[self sendToEngine: fort];
- [fort release];
NSString *voicepack = [[NSString alloc] initWithFormat:@"evoicepack %@", [teamData objectForKey:@"voicepack"]];
[self sendToEngine: voicepack];
- [voicepack release];
NSString *flag = [[NSString alloc] initWithFormat:@"eflag %@", [teamData objectForKey:@"flag"]];
[self sendToEngine: flag];
- [flag release];
NSArray *hogs = [teamData objectForKey:@"hedgehogs"];
for (int i = 0; i < numberOfPlayingHogs; i++) {
@@ -99,21 +87,16 @@
NSString *hogLevelHealthAndName = [[NSString alloc] initWithFormat:@"eaddhh %@ %ld %@",
[hog objectForKey:@"level"], (long)initialHealth, [hog objectForKey:@"hogname"]];
[self sendToEngine: hogLevelHealthAndName];
- [hogLevelHealthAndName release];
NSString *hogHat = [[NSString alloc] initWithFormat:@"ehat %@", [hog objectForKey:@"hat"]];
[self sendToEngine: hogHat];
- [hogHat release];
}
-
- [teamData release];
}
// unpacks ammostore data from the selected ammo.plist to a sequence of engine commands
--(void) provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger) numberOfTeams {
+- (void)provideAmmoData:(NSString *)ammostoreName forPlayingTeams:(NSInteger)numberOfTeams {
NSString *weaponPath = [[NSString alloc] initWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),ammostoreName];
NSDictionary *ammoData = [[NSDictionary alloc] initWithContentsOfFile:weaponPath];
- [weaponPath release];
// if we're loading an older version of ammos fill the engine message with 0s
int diff = HW_getNumberOfWeapons() - [[ammoData objectForKey:@"ammostore_initialqt"] length];
@@ -123,34 +106,28 @@
NSString *ammloadt = [[NSString alloc] initWithFormat:@"eammloadt %@%@", [ammoData objectForKey:@"ammostore_initialqt"], update];
[self sendToEngine: ammloadt];
- [ammloadt release];
NSString *ammprob = [[NSString alloc] initWithFormat:@"eammprob %@%@", [ammoData objectForKey:@"ammostore_probability"], update];
[self sendToEngine: ammprob];
- [ammprob release];
NSString *ammdelay = [[NSString alloc] initWithFormat:@"eammdelay %@%@", [ammoData objectForKey:@"ammostore_delay"], update];
[self sendToEngine: ammdelay];
- [ammdelay release];
NSString *ammreinf = [[NSString alloc] initWithFormat:@"eammreinf %@%@", [ammoData objectForKey:@"ammostore_crate"], update];
[self sendToEngine: ammreinf];
- [ammreinf release];
// send this for each team so it applies the same ammostore to all teams
NSString *ammstore = [[NSString alloc] initWithString:@"eammstore"];
- for (int i = 0; i < numberOfTeams; i++)
+ for (int i = 0; i < numberOfTeams; i++) {
[self sendToEngine: ammstore];
- [ammstore release];
-
- [ammoData release];
+ }
}
// unpacks scheme data from the selected scheme.plist to a sequence of engine commands
--(NSInteger) provideScheme:(NSString *)schemeName {
+- (NSInteger)provideScheme:(NSString *)schemeName {
NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),schemeName];
NSDictionary *schemeDictionary = [[NSDictionary alloc] initWithContentsOfFile:schemePath];
- [schemePath release];
+
NSArray *basicArray = [schemeDictionary objectForKey:@"basic"];
NSArray *gamemodArray = [schemeDictionary objectForKey:@"gamemod"];
int result = 0;
@@ -164,7 +141,6 @@
}
NSString *flags = [[NSString alloc] initWithFormat:@"e$gmflags %d",result];
[self sendToEngine:flags];
- [flags release];
// basic game flags
result = [[basicArray objectAtIndex:0] intValue];
@@ -180,17 +156,14 @@
value = value * 1000;
NSString *strToSend = [[NSString alloc] initWithFormat:@"%@ %d",command,value];
[self sendToEngine:strToSend];
- [strToSend release];
}
- [basic release];
- [schemeDictionary release];
return result;
}
#pragma mark -
#pragma mark Network relevant code
--(void) dumpRawData:(const char *)buffer ofSize:(uint8_t) length {
+- (void)dumpRawData:(const char *)buffer ofSize:(uint8_t) length {
[self.stream write:&length maxLength:1];
[self.stream write:(const uint8_t *)buffer maxLength:length];
}
@@ -213,7 +186,7 @@
}
// this is launched as thread and handles all IPC with engine
--(void) engineProtocol:(id) object {
+- (void)engineProtocol:(id)object {
@autoreleasepool {
NSDictionary *gameConfig = (NSDictionary *)object;
@@ -259,7 +232,7 @@
break;
switch (buffer[0]) {
- case 'C':
+ case 'C': {
DLog(@"Sending game config...\n%@", gameConfig);
/*if (isNetGame == YES)
@@ -310,15 +283,18 @@
ofColor:[teamData objectForKey:@"color"]];
}
break;
- case '?':
+ }
+ case '?': {
DLog(@"Ping? Pong!");
[self sendToEngine:@"!"];
break;
- case 'E':
+ }
+ case 'E': {
DLog(@"ERROR - last console line: [%s]", &buffer[1]);
clientQuit = YES;
break;
- case 'e':
+ }
+ case 'e': {
[self dumpRawData:buffer ofSize:msgSize];
sscanf((char *)buffer, "%*s %d", &eProto);
@@ -333,21 +309,22 @@
clientQuit = YES;
}
break;
- case 'i':
+ }
+ case 'i': {
if (statsArray == nil) {
statsArray = [[NSMutableArray alloc] initWithCapacity:10 - 2];
NSMutableArray *ranking = [[NSMutableArray alloc] initWithCapacity:4];
[statsArray insertObject:ranking atIndex:0];
- [ranking release];
}
NSString *tempStr = [NSString stringWithUTF8String:&buffer[2]];
NSArray *info = [tempStr componentsSeparatedByString:@" "];
NSString *arg = [info objectAtIndex:0];
int index = [arg lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 3;
switch (buffer[1]) {
- case 'r': // winning team
+ case 'r': { // winning team
[statsArray insertObject:[NSString stringWithUTF8String:&buffer[2]] atIndex:1];
break;
+ }
case 'D': // best shot
{
NSString *hogName = [NSString stringWithUTF8String:&buffer[index]];
@@ -394,19 +371,21 @@
break;
}
break;
- case 'q':
+ }
+ case 'q': {
// game ended and match finished, statsArray is full of delicious statistics
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(gameEndedWithStatistics:)])
[self.delegate gameEndedWithStatistics:statsArray];
- [statsArray release];
[HWUtils setGameStatus:gsEnded];
// closing connection here would trigger a "IPC connection lost" error, so we have to wait until recv fails
break;
- case 'Q':
+ }
+ case 'Q': {
// game exited but not completed, skip this message in the savefile
[HWUtils setGameStatus:gsInterrupted];
// same here, don't set clientQuit to YES
break;
+ }
default:
[self dumpRawData:buffer ofSize:msgSize];
break;
@@ -415,7 +394,6 @@
DLog(@"Engine exited, ending thread");
[self.stream close];
- [self.stream release];
// Close the client socket
[HWUtils freePort:self.enginePort];
--- a/project_files/HedgewarsMobile/Classes/ExtraCategories.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.h Sun Mar 11 20:43:15 2018 +0100
@@ -30,7 +30,7 @@
@interface UITableView (backgroundColor)
--(void) setBackgroundColorForAnyTable:(UIColor *)color;
+- (void)setBackgroundColorForAnyTable:(UIColor *)color;
@end
@@ -48,7 +48,7 @@
@interface UIButton (quickStyle)
--(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title;
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title;
- (void)applyBlackQuickStyle;
- (void)applyDarkBlueQuickStyle;
@@ -58,9 +58,9 @@
@interface UILabel (quickStyle)
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title;
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth;
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title;
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat)borderWidth;
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat)borderWidth
withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor;
@end
--- a/project_files/HedgewarsMobile/Classes/ExtraCategories.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.m Sun Mar 11 20:43:15 2018 +0100
@@ -47,12 +47,11 @@
#pragma mark -
@implementation UITableView (backgroundColor)
--(void) setBackgroundColorForAnyTable:(UIColor *) color {
+- (void)setBackgroundColorForAnyTable:(UIColor *) color {
if ([self respondsToSelector:@selector(backgroundView)]) {
UIView *backView = [[UIView alloc] initWithFrame:self.frame];
backView.backgroundColor = color;
self.backgroundView = backView;
- [backView release];
self.backgroundColor = [UIColor clearColor];
} else
self.backgroundColor = color;
@@ -97,8 +96,8 @@
#pragma mark -
@implementation UIButton (quickStyle)
--(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title {
- [self initWithFrame:frame];
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title {
+ if (!(self = [self initWithFrame:frame])) return nil;
[self setTitle:title forState:UIControlStateNormal];
[self applyBlackQuickStyle];
@@ -137,7 +136,7 @@
#pragma mark -
@implementation UILabel (quickStyle)
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title {
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title {
return [self initWithFrame:frame
andTitle:title
withBorderWidth:1.5f
@@ -145,7 +144,7 @@
withBackgroundColor:[UIColor darkBlueColor]];
}
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth {
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat)borderWidth {
return [self initWithFrame:frame
andTitle:title
withBorderWidth:borderWidth
@@ -153,7 +152,7 @@
withBackgroundColor:[UIColor darkBlueColorTransparent]];
}
--(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth
+- (id)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat)borderWidth
withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor {
UILabel *theLabel = [self initWithFrame:frame];
theLabel.backgroundColor = backColor;
--- a/project_files/HedgewarsMobile/Classes/FlagsViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -28,9 +28,9 @@
NSIndexPath *lastIndexPath;
}
-@property (nonatomic,retain) NSDictionary * teamDictionary;
-@property (nonatomic,retain) NSArray *flagArray;
-@property (nonatomic,retain) NSArray *communityArray;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSDictionary * teamDictionary;
+@property (nonatomic, strong) NSArray *flagArray;
+@property (nonatomic, strong) NSArray *communityArray;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
@end
--- a/project_files/HedgewarsMobile/Classes/FlagsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/FlagsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@implementation FlagsViewController
@synthesize teamDictionary, flagArray, communityArray, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *array_na = [[NSMutableArray alloc] init];
@@ -45,14 +45,12 @@
}
self.flagArray = array_na;
- [array_na release];
self.communityArray = array_cm;
- [array_cm release];
self.title = NSLocalizedString(@"Set team flag",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// reloadData needed because team might change
[self.tableView reloadData];
@@ -62,11 +60,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return [self.flagArray count];
else
@@ -80,7 +78,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSString *flagName = nil;
@@ -94,9 +92,7 @@
}
NSString *flagFile = [[NSString alloc] initWithFormat:@"%@/%@", FLAGS_DIRECTORY(), flagName];
UIImage *flagSprite = [[UIImage alloc] initWithContentsOfFile:flagFile];
- [flagFile release];
cell.imageView.image = flagSprite;
- [flagSprite release];
cell.imageView.layer.borderWidth = 1;
cell.imageView.layer.borderColor = [[UIColor blackColor] CGColor];
@@ -130,7 +126,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
NSInteger newSection = [indexPath section];
@@ -163,29 +159,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.lastIndexPath = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.teamDictionary = nil;
- self.lastIndexPath = nil;
- self.flagArray = nil;
- self.communityArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(teamDictionary);
- releaseAndNil(lastIndexPath);
- releaseAndNil(flagArray);
- releaseAndNil(communityArray);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/FortsViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/FortsViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -27,8 +27,8 @@
NSIndexPath *lastIndexPath;
}
-@property (nonatomic,retain) NSDictionary * teamDictionary;
-@property (nonatomic,retain) NSArray *fortArray;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSDictionary * teamDictionary;
+@property (nonatomic, strong) NSArray *fortArray;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
@end
--- a/project_files/HedgewarsMobile/Classes/FortsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/FortsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -26,14 +26,14 @@
@synthesize teamDictionary, fortArray, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
NSArray *directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FORTS_DIRECTORY() error:NULL];
@@ -49,7 +49,6 @@
}
}
self.fortArray = filteredContents;
- [filteredContents release];
// statically set row height instead of using delegate method for performance reasons
self.tableView.rowHeight = 128;
@@ -58,7 +57,7 @@
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
@@ -67,11 +66,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.fortArray count];
}
@@ -81,17 +80,15 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
- reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier];
NSString *fortName = [fortArray objectAtIndex:[indexPath row]];
cell.textLabel.text = fortName;
NSString *fortFile = [[NSString alloc] initWithFormat:@"%@/%@-preview.png", FORTS_DIRECTORY(), fortName];
UIImage *fortSprite = [[UIImage alloc] initWithContentsOfFile:fortFile];
- [fortFile release];
cell.imageView.image = fortSprite;
- [fortSprite release];
//cell.detailTextLabel.text = @"Insert funny description here";
if ([cell.textLabel.text isEqualToString:[self.teamDictionary objectForKey:@"fort"]]) {
@@ -107,7 +104,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -132,28 +129,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.lastIndexPath = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.teamDictionary = nil;
- self.lastIndexPath = nil;
- self.fortArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
-
--(void) dealloc {
- releaseAndNil(teamDictionary);
- releaseAndNil(lastIndexPath);
- releaseAndNil(fortArray);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -45,9 +45,9 @@
@property (nonatomic,retain) IBOutlet MapConfigViewController *mapConfigViewController;
@property (nonatomic,retain) HelpPageLobbyViewController *helpPage;
--(IBAction) buttonPressed:(id) sender;
--(IBAction) segmentPressed:(id) sender;
--(void) startGame:(UIButton *)button;
--(BOOL) isEverythingSet;
+- (IBAction)buttonPressed:(id)sender;
+- (IBAction)segmentPressed:(id)sender;
+- (void)startGame:(UIButton *)button;
+- (BOOL)isEverythingSet;
@end
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -35,13 +35,13 @@
@synthesize imgContainer, titleImage, sliderBackground, helpPage,
mapConfigViewController, teamConfigViewController, schemeWeaponConfigViewController;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark - Buttons
--(IBAction) buttonPressed:(id) sender {
+- (IBAction)buttonPressed:(id)sender {
UIButton *theButton = (UIButton *)sender;
switch (theButton.tag) {
@@ -53,7 +53,6 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
} else {
[[AudioManagerController mainManager] playBackSound];
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
@@ -68,7 +67,7 @@
[self startGame:theButton];
break;
- case 2:
+ case 2: {
[[AudioManagerController mainManager] playClickSound];
if (self.helpPage == nil)
self.helpPage = [[HelpPageLobbyViewController alloc] initWithNibName:@"HelpPageLobbyViewController-iPad" bundle:nil];
@@ -79,6 +78,7 @@
self.helpPage.view.alpha = 1;
}];
break;
+ }
default:
DLog(@"Nope");
break;
@@ -96,7 +96,7 @@
}
}
--(IBAction) segmentPressed:(id) sender {
+- (IBAction)segmentPressed:(id)sender {
UISegmentedControl *theSegment = (UISegmentedControl *)sender;
@@ -138,7 +138,7 @@
#pragma mark -
--(BOOL) isEverythingSet {
+- (BOOL)isEverythingSet {
// don't start playing if the preview is in progress
if ([self.mapConfigViewController busy]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"")
@@ -147,7 +147,6 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
@@ -159,7 +158,6 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
@@ -174,7 +172,6 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
@@ -186,7 +183,6 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
@@ -198,14 +194,12 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
// play if the gameflags are set correctly (divideteam works only with 2 teams)
NSString *schemePath = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),self.schemeWeaponConfigViewController.selectedScheme];
NSArray *gameFlags = [[NSDictionary dictionaryWithContentsOfFile:schemePath] objectForKey:@"gamemod"];
- [schemePath release];
if ([[gameFlags objectAtIndex:2] boolValue] && [self.teamConfigViewController.listOfSelectedTeams count] != 2) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Scheme mismatch",@"")
message:NSLocalizedString(@"The scheme you selected allows only for two teams",@"")
@@ -213,14 +207,13 @@
cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"")
otherButtonTitles:nil];
[alert show];
- [alert release];
return NO;
}
return YES;
}
--(void) startGame:(UIButton *)button {
+- (void)startGame:(UIButton *)button {
button.enabled = YES;
NSString *script = self.mapConfigViewController.missionCommand;
@@ -243,17 +236,14 @@
[GameInterfaceBridge registerCallingController:self];
[GameInterfaceBridge startLocalGame:gameDictionary];
- [gameDictionary release];
}
--(void) loadNiceHogs
+- (void)loadNiceHogs
{
@autoreleasepool
{
-
NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Hedgehog/Idle.png",GRAPHICS_DIRECTORY()];
UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:filePath];
- [filePath release];
NSArray *hatArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:HATS_DIRECTORY() error:NULL];
NSUInteger numberOfHats = [hatArray count];
@@ -274,15 +264,14 @@
UIImage *hatSpriteFrame = [hatSprite cutAt:CGRectMake(x, y, 32, 32)];
UIImage *hogSpriteFrame = [hogSprite cutAt:CGRectMake(x, y, 32, 32)];
UIImage *hogWithHat = [hogSpriteFrame mergeWith:hatSpriteFrame atPoint:CGPointMake(0, 5)];
- [animation addObject:hogWithHat];
+ if (hogWithHat) {
+ [animation addObject:hogWithHat];
+ }
}
- [hatSprite release];
- [hatFile release];
- UIImageView *hog = [[UIImageView alloc] initWithImage:[animation objectAtIndex:0]];
+ UIImageView *hog = [[UIImageView alloc] initWithImage:[animation firstObject]];
hog.animationImages = animation;
hog.animationDuration = 3;
- [animation release];
int x = 20*i+arc4random_uniform(128);
while (x > 320 - 32)
@@ -291,9 +280,7 @@
hog.frame = CGRectMake(x, 25, hog.frame.size.width, hog.frame.size.height);
[self.imgContainer addSubview:hog];
[hog startAnimating];
- [hog release];
}
- [hogSprite release];
dispatch_async(dispatch_get_main_queue(), ^{
@@ -324,7 +311,7 @@
self.imgContainer = nil;
}
--(void) viewDidLoad
+- (void)viewDidLoad
{
[super viewDidLoad];
@@ -340,7 +327,6 @@
andTitle:nil
withBorderWidth:2.0f];
self.sliderBackground = backLabel;
- [backLabel release];
[self.view addSubview:self.sliderBackground];
// the label for max hogs
@@ -352,7 +338,6 @@
maxLabel.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:maxLabel];
self.mapConfigViewController.maxLabel = maxLabel;
- [maxLabel release];
}
else
{
@@ -368,7 +353,7 @@
[self.view bringSubviewToFront:self.mapConfigViewController.slider];
}
--(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval) duration {
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval) duration {
if (IS_IPAD() == NO)
return;
@@ -404,7 +389,7 @@
}
}
--(void) viewWillAppear:(BOOL)animated
+- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
@@ -434,7 +419,7 @@
}
}
--(void) didReceiveMemoryWarning
+- (void)didReceiveMemoryWarning
{
[self clearImgContainer];
@@ -455,30 +440,4 @@
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.imgContainer = nil;
- self.titleImage = nil;
- self.sliderBackground = nil;
- self.schemeWeaponConfigViewController = nil;
- self.teamConfigViewController = nil;
- self.mapConfigViewController = nil;
- self.helpPage = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(_tabsSegmentedControl);
- releaseAndNil(_backButton);
- releaseAndNil(_startButton);
- releaseAndNil(imgContainer);
- releaseAndNil(titleImage);
- releaseAndNil(sliderBackground);
- releaseAndNil(schemeWeaponConfigViewController);
- releaseAndNil(teamConfigViewController);
- releaseAndNil(mapConfigViewController);
- releaseAndNil(helpPage);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.h Sun Mar 11 20:43:15 2018 +0100
@@ -27,16 +27,16 @@
NSInteger port;
}
-@property (nonatomic,retain) UIView *blackView;
-@property (nonatomic,retain) NSString *savePath;
+@property (nonatomic, strong) UIView *blackView;
+@property (nonatomic, strong) NSString *savePath;
@property (assign) NSInteger port;
-+(void) startLocalGame:(NSDictionary *)withOptions;
-+(void) startSaveGame:(NSString *)atPath;
-+(void) startMissionGame:(NSString *)withScript;
-+(void) startCampaignMissionGameWithScript:(NSString *)missionScriptName forCampaign:(NSString *)campaignName;
-+(void) startSimpleGame;
++ (void)startLocalGame:(NSDictionary *)withOptions;
++ (void)startSaveGame:(NSString *)atPath;
++ (void)startMissionGame:(NSString *)withScript;
++ (void)startCampaignMissionGameWithScript:(NSString *)missionScriptName forCampaign:(NSString *)campaignName;
++ (void)startSimpleGame;
-+(void) registerCallingController:(UIViewController *)controller;
++ (void)registerCallingController:(UIViewController *)controller;
@end
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Sun Mar 11 20:43:15 2018 +0100
@@ -30,15 +30,13 @@
#pragma mark -
#pragma mark Instance methods for engine interaction
// prepares the controllers for hosting a game
--(void) earlyEngineLaunch:(NSDictionary *)optionsOrNil {
- [self retain];
+- (void)earlyEngineLaunch:(NSDictionary *)optionsOrNil {
[[AudioManagerController mainManager] fadeOutBackgroundMusic];
EngineProtocolNetwork *engineProtocol = [[EngineProtocolNetwork alloc] init];
self.port = engineProtocol.enginePort;
engineProtocol.delegate = self;
[engineProtocol spawnThread:self.savePath withOptions:optionsOrNil];
- [engineProtocol release];
// add a black view hiding the background
UIWindow *thisWindow = [[HedgewarsAppDelegate sharedAppDelegate] uiwindow];
@@ -52,7 +50,6 @@
self.blackView.alpha = 1;
[UIView commitAnimations];
[thisWindow addSubview:self.blackView];
- [self.blackView release];
// keep the point of return for games that completed loading
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
@@ -65,7 +62,7 @@
}
// cleans up everything
--(void) lateEngineLaunch {
+- (void)lateEngineLaunch {
// notify views below that they are getting the spotlight again
[[[HedgewarsAppDelegate sharedAppDelegate] uiwindow] makeKeyAndVisible];
[callingController viewWillAppear:YES];
@@ -91,11 +88,10 @@
[[AudioManagerController mainManager] fadeInBackgroundMusic];
[HWUtils setGameStatus:gsNone];
[HWUtils setGameType:gtNone];
- [self release];
}
// main routine for calling the actual game engine
--(void) engineLaunch {
+- (void)engineLaunch {
CGFloat width, height;
CGFloat screenScale = [[UIScreen mainScreen] safeScale];
NSString *ipcString = [[NSString alloc] initWithFormat:@"%d",self.port];
@@ -141,11 +137,6 @@
@"--prefix", resourcePath,
@"--user-prefix", documentsDirectory,
nil];
- [verticalSize release];
- [horizontalSize release];
- [resourcePath release];
- [localeString release];
- [ipcString release];
NSString *username = [settings objectForKey:@"username"];
if ([username length] > 0) {
@@ -175,7 +166,6 @@
const char **argv = (const char **)malloc(sizeof(const char*)*argc);
for (int i = 0; i < argc; i++)
argv[i] = strdup([[gameParameters objectAtIndex:i] UTF8String]);
- [gameParameters release];
// this is the pascal function that starts the game
RunEngine(argc, argv);
@@ -189,88 +179,76 @@
[self lateEngineLaunch];
}
--(void) dealloc {
- releaseAndNil(blackView);
- releaseAndNil(savePath);
- [super dealloc];
-}
#pragma mark -
#pragma mark EngineProtocolDelegate methods
--(void) gameEndedWithStatistics:(NSArray *)stats {
+- (void)gameEndedWithStatistics:(NSArray *)stats {
+ [self performSelectorOnMainThread:@selector(presentStats:) withObject:stats waitUntilDone:NO];
+}
+
+- (void)presentStats:(NSArray *)stats {
if (stats != nil) {
StatsPageViewController *statsPage = [[StatsPageViewController alloc] init];
statsPage.statsArray = stats;
statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[callingController presentViewController:statsPage animated:YES completion:nil];
- [statsPage release];
}
}
#pragma mark -
#pragma mark Class methods for setting up the engine from outsite
-+(void) registerCallingController:(UIViewController *)controller {
++ (void)registerCallingController:(UIViewController *)controller {
callingController = controller;
}
-+(void) startGame:(TGameType) type atPath:(NSString *)path withOptions:(NSDictionary *)config {
++ (void)startGame:(TGameType)type atPath:(NSString *)path withOptions:(NSDictionary *)config {
[HWUtils setGameType:type];
id bridge = [[self alloc] init];
[bridge setSavePath:path];
[bridge earlyEngineLaunch:config];
- [bridge release];
}
-+(void) startLocalGame:(NSDictionary *)withOptions {
++ (void)startLocalGame:(NSDictionary *)withOptions {
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"yyyy-MM-dd '@' HH.mm"];
NSString *savePath = [[NSString alloc] initWithFormat:@"%@%@.hws",SAVES_DIRECTORY(),[outputFormatter stringFromDate:[NSDate date]]];
- [outputFormatter release];
// in the rare case in which a savefile with the same name exists the older one must be removed (otherwise it gets corrupted)
if ([[NSFileManager defaultManager] fileExistsAtPath:savePath])
[[NSFileManager defaultManager] removeItemAtPath:savePath error:nil];
[self startGame:gtLocal atPath:savePath withOptions:withOptions];
- [savePath release];
}
-+(void) startSaveGame:(NSString *)atPath {
++ (void)startSaveGame:(NSString *)atPath {
[self startGame:gtSave atPath:atPath withOptions:nil];
}
-+(void) startMissionGame:(NSString *)withScript {
++ (void)startMissionGame:(NSString *)withScript {
NSString *seedCmd = [self seedCommand];
NSString *missionPath = [[NSString alloc] initWithFormat:@"escript Missions/Training/%@.lua",withScript];
NSDictionary *missionDict = [[NSDictionary alloc] initWithObjectsAndKeys:missionPath, @"mission_command", seedCmd, @"seed_command", nil];
- [missionPath release];
- [seedCmd release];
[self startGame:gtMission atPath:nil withOptions:missionDict];
- [missionDict release];
}
-+(NSString *) seedCommand {
++ (NSString *)seedCommand {
// generate a seed
NSString *seed = [HWUtils seed];
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
- [seed release];
return seedCmd;
}
-+(void) startCampaignMissionGameWithScript:(NSString *)missionScriptName forCampaign:(NSString *)campaignName {
++ (void)startCampaignMissionGameWithScript:(NSString *)missionScriptName forCampaign:(NSString *)campaignName {
NSString *seedCmd = [self seedCommand];
NSString *campaignMissionPath = [[NSString alloc] initWithFormat:@"escript Missions/Campaign/%@/%@", campaignName, missionScriptName];
NSDictionary *campaignMissionDict = [[NSDictionary alloc] initWithObjectsAndKeys:campaignMissionPath, @"mission_command", seedCmd, @"seed_command", nil];
- [campaignMissionPath release];
- [seedCmd release];
[self startGame:gtCampaign atPath:nil withOptions:campaignMissionDict];
- [campaignMissionDict release];
}
-+(void) startSimpleGame {
++ (void)startSimpleGame {
NSString *seedCmd = [self seedCommand];
// pick a random static map
@@ -278,9 +256,7 @@
NSString *mapName = [listOfMaps objectAtIndex:arc4random_uniform((int)[listOfMaps count])];
NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg",MAPS_DIRECTORY(),mapName];
NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
- [fileCfg release];
NSArray *split = [contents componentsSeparatedByString:@"\n"];
- [contents release];
NSString *themeCommand = [[NSString alloc] initWithFormat:@"etheme %@", [split objectAtIndex:0]];
NSString *staticMapCommand = [[NSString alloc] initWithFormat:@"emap %@", mapName];
@@ -301,8 +277,6 @@
[NSNumber numberWithUnsignedInt:secondColor],@"color",
@"Robots.plist",@"team",nil];
NSArray *listOfTeams = [[NSArray alloc] initWithObjects:firstTeam,secondTeam,nil];
- [firstTeam release];
- [secondTeam release];
// create the configuration
NSDictionary *gameDictionary = [[NSDictionary alloc] initWithObjectsAndKeys:
@@ -317,14 +291,9 @@
@"Default.plist",@"weapon",
@"",@"mission_command",
nil];
- [listOfTeams release];
- [staticMapCommand release];
- [themeCommand release];
- [seedCmd release];
// launch game
[GameInterfaceBridge startLocalGame:gameDictionary];
- [gameDictionary release];
}
@end
--- a/project_files/HedgewarsMobile/Classes/GameLogViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameLogViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -41,14 +41,12 @@
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(dismissAction)];
self.navigationItem.rightBarButtonItem = closeButton;
- [closeButton release];
#ifdef DEBUG
if ([self allowSendLogByEmail])
{
UIBarButtonItem *sendButton = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStylePlain target:self action:@selector(sendLogByEmailAction)];
self.navigationItem.leftBarButtonItem = sendButton;
- [sendButton release];
}
#endif
@@ -61,11 +59,9 @@
UITextView *logView = [[UITextView alloc] initWithFrame:self.view.frame];
[logView setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)];
logView.text = debugStr;
- [debugStr release];
logView.editable = NO;
[self.view addSubview:logView];
- [logView release];
}
#pragma mark - Parameters
@@ -95,7 +91,6 @@
[picker setMessageBody:emailBody isHTML:NO];
[self presentViewController:picker animated:YES completion:nil];
- [picker release];
}
#endif
--- a/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GeneralSettingsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,23 +23,23 @@
@implementation GeneralSettingsViewController
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View Lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
self.navigationItem.title = NSLocalizedString(@"Edit game options", nil);
[super viewDidLoad];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
[super viewWillAppear:animated];
}
--(void) viewWillDisappear:(BOOL)animated {
+- (void)viewWillDisappear:(BOOL)animated {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults synchronize];
if ([[userDefaults objectForKey:@"music"] boolValue] == NO)
@@ -49,7 +49,7 @@
}
#pragma mark -
--(void) switchValueChanged:(id) sender {
+- (void)switchValueChanged:(id)sender {
UISwitch *theSwitch = (UISwitch *)sender;
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
@@ -76,7 +76,7 @@
}
}
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue {
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
if (tagValue == 40)
@@ -87,11 +87,11 @@
#pragma mark -
#pragma mark TableView Methods
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section {
switch (section) {
case 0: // user and pass
return 1; // set 2 here to show the password field
@@ -143,7 +143,7 @@
case 0:
editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:cellIdentifier0];
if (nil == editableCell) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier0] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier0];
editableCell.minimumCharacters = 0;
editableCell.delegate = self;
editableCell.textField.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
@@ -170,11 +170,10 @@
case 1:
cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier1];
if (nil == cell) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier1] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier1];
UISwitch *theSwitch = [[UISwitch alloc] init];
[theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = theSwitch;
- [theSwitch release];
}
switchContent = (UISwitch *)cell.accessoryView;
@@ -191,11 +190,10 @@
case 2:
cell = [aTableView dequeueReusableCellWithIdentifier:cellIdentifier2];
if (nil == cell) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier2] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier2];
UISwitch *theSwitch = [[UISwitch alloc] init];
[theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = theSwitch;
- [theSwitch release];
}
switchContent = (UISwitch *)cell.accessoryView;
@@ -231,7 +229,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
if (0 == [indexPath section]) {
EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
@@ -242,16 +240,9 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- [super viewDidUnload];
-}
-
--(void) dealloc {
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/GravesViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GravesViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -27,8 +27,8 @@
NSIndexPath *lastIndexPath;
}
-@property (nonatomic,retain) NSMutableDictionary *teamDictionary;
-@property (nonatomic,retain) NSArray *graveArray;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSMutableDictionary *teamDictionary;
+@property (nonatomic, strong) NSArray *graveArray;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
@end
--- a/project_files/HedgewarsMobile/Classes/GravesViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/GravesViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,13 +23,13 @@
@implementation GravesViewController
@synthesize teamDictionary, graveArray, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
// load all the grave names and store them into graveArray
@@ -38,7 +38,7 @@
self.title = NSLocalizedString(@"Choose hedgehog graves",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
// this moves the tableview to the top
@@ -48,11 +48,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.graveArray count];
}
@@ -62,7 +62,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSString *grave = [self.graveArray objectAtIndex:[indexPath row]];
cell.textLabel.text = [grave stringByDeletingPathExtension];
@@ -77,9 +77,7 @@
NSString *graveFilePath = [[NSString alloc] initWithFormat:@"%@/%@",GRAVES_DIRECTORY(),grave];
// because we also have multi frame graves, let's take the first one only
UIImage *graveSprite = [[UIImage alloc] initWithContentsOfFile:graveFilePath andCutAt:CGRectMake(0, 0, 32, 32)];
- [graveFilePath release];
cell.imageView.image = graveSprite;
- [graveSprite release];
return cell;
}
@@ -87,7 +85,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -111,27 +109,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.lastIndexPath = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.lastIndexPath = nil;
- self.teamDictionary = nil;
- self.graveArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(graveArray);
- releaseAndNil(teamDictionary);
- releaseAndNil(lastIndexPath);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/HWUtils.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.h Sun Mar 11 20:43:15 2018 +0100
@@ -27,23 +27,23 @@
}
-+(TGameType) gameType;
-+(void) setGameType:(TGameType) type;
-+(TGameStatus) gameStatus;
-+(void) setGameStatus:(TGameStatus) status;
-+(BOOL) isGameLaunched;
-+(BOOL) isGameRunning;
++ (TGameType)gameType;
++ (void)setGameType:(TGameType)type;
++ (TGameStatus)gameStatus;
++ (void)setGameStatus:(TGameStatus)status;
++ (BOOL)isGameLaunched;
++ (BOOL)isGameRunning;
-+(NSString *)modelType;
-+(NSArray *)teamColors;
-+(void) releaseCache;
++ (NSString *)modelType;
++ (NSArray *)teamColors;
++ (void)releaseCache;
-+(NSInteger) randomPort;
-+(void) freePort:(NSInteger) port;
-+(BOOL) isNetworkReachable;
-+(NSString *) languageID;
-//+(UIView *)mainSDLViewInstance;
-+(NSString *) seed;
++ (NSInteger)randomPort;
++ (void)freePort:(NSInteger)port;
++ (BOOL)isNetworkReachable;
++ (NSString *)languageID;
+//+ (UIView *)mainSDLViewInstance;
++ (NSString *)seed;
@end
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Sun Mar 11 20:43:15 2018 +0100
@@ -35,33 +35,33 @@
#pragma mark -
#pragma mark game status and type info
-+(TGameType) gameType {
++ (TGameType)gameType {
return gameType;
}
-+(void) setGameType:(TGameType) type {
++ (void)setGameType:(TGameType)type {
gameType = type;
}
-+(TGameStatus) gameStatus {
++ (TGameStatus)gameStatus {
return gameStatus;
}
-+(void) setGameStatus:(TGameStatus) status {
++ (void)setGameStatus:(TGameStatus)status {
gameStatus = status;
}
-+(BOOL) isGameLaunched {
++ (BOOL)isGameLaunched {
return ((gameStatus == gsLoading) || (gameStatus == gsInGame));
}
-+(BOOL) isGameRunning {
++ (BOOL)isGameRunning {
return (gameStatus == gsInGame);
}
#pragma mark -
#pragma mark Helper Functions with cache
-+(NSString *)modelType {
++ (NSString *)modelType {
if (cachedModel == nil) {
size_t size;
// set 'oldp' parameter to NULL to get the size of the data returned so we can allocate appropriate amount of space
@@ -70,13 +70,13 @@
// get the platform name
sysctlbyname("hw.machine", name, &size, NULL, 0);
- cachedModel = [[NSString stringWithUTF8String:name] retain];
+ cachedModel = [NSString stringWithUTF8String:name];
free(name);
}
return cachedModel;
}
-+(NSArray *)teamColors {
++ (NSArray *)teamColors {
if (cachedColors == nil) {
// by default colors are ARGB but we do computation over RGB, hence we have to "& 0x00FFFFFF" before processing
unsigned int colors[] = HW_TEAMCOLOR_ARRAY;
@@ -86,24 +86,23 @@
while(colors[i] != 0)
[array addObject:[NSNumber numberWithUnsignedInt:(colors[i++] & 0x00FFFFFF)]];
- cachedColors = [[NSArray arrayWithArray:array] retain];
- [array release];
+ cachedColors = [NSArray arrayWithArray:array];
}
return cachedColors;
}
-+(void) releaseCache {
- [cachedModel release], cachedModel = nil;
- [cachedColors release], cachedColors = nil;
++ (void)releaseCache {
+ cachedModel = nil;
+ cachedColors = nil;
// don't release activePorts here
}
#pragma mark -
#pragma mark Helper Functions without cache
-+(NSInteger) randomPort {
++ (NSInteger)randomPort {
// set a new feed only at initialization time and forbid connecting to the server port
if (activePorts == nil) {
- activePorts = [[NSMutableArray arrayWithObject:[NSNumber numberWithInt:NETGAME_DEFAULT_PORT]] retain];
+ activePorts = [NSMutableArray arrayWithObject:[NSNumber numberWithInt:NETGAME_DEFAULT_PORT]];
}
// pick a random number from the free ports list
@@ -117,11 +116,11 @@
return res;
}
-+(void) freePort:(NSInteger) port {
++ (void)freePort:(NSInteger)port {
[activePorts removeObject:[NSNumber numberWithInteger:port]];
}
-+(BOOL) isNetworkReachable {
++ (BOOL)isNetworkReachable {
// Create zero addy
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
@@ -150,7 +149,6 @@
timeoutInterval:20.0];
NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:nil];
BOOL testResult = testConnection ? YES : NO;
- [testConnection release];
return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO;
}
@@ -162,7 +160,7 @@
}
/*
-+(UIView *)mainSDLViewInstance {
++ (UIView *)mainSDLViewInstance {
SDL_Window *window = HW_getSDLWindow();
if (window == NULL) {
SDL_SetError("Window does not exist");
@@ -177,7 +175,7 @@
+ (NSString *)seed
{
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
- NSString *seed = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
+ NSString *seed = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, uuid));
CFRelease(uuid);
return seed;
}
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.h Sun Mar 11 20:43:15 2018 +0100
@@ -28,8 +28,8 @@
UIWindow *uiwindow;
}
-@property (nonatomic,retain) MainMenuViewController *mainViewController;
-@property (nonatomic,retain) UIWindow *uiwindow;
+@property (nonatomic, strong) MainMenuViewController *mainViewController;
+@property (nonatomic, strong) UIWindow *uiwindow;
@end
--- a/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HedgewarsAppDelegate.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,7 +24,7 @@
@implementation SDLUIKitDelegate (customDelegate)
// hijack the the SDL_UIKitAppDelegate to use the UIApplicationDelegate we implement here
-+(NSString *)getAppDelegateClassName {
++ (NSString *)getAppDelegateClassName {
return @"HedgewarsAppDelegate";
}
@@ -35,7 +35,7 @@
#pragma mark -
#pragma mark AppDelegate methods
--(id) init {
+- (id)init {
if ((self = [super init])) {
mainViewController = nil;
uiwindow = nil;
@@ -43,14 +43,9 @@
return self;
}
--(void) dealloc {
- [mainViewController release];
- [uiwindow release];
- [super dealloc];
-}
// override the direct execution of SDL_main to allow us to implement our own frontend
--(void) postFinishLaunch
+- (void)postFinishLaunch
{
// Setup Appirater
[Appirater setAppId:@"391234866"];
@@ -70,12 +65,11 @@
NSString *controllerName = (IS_IPAD() ? @"MainMenuViewController-iPad" : @"MainMenuViewController-iPhone");
self.mainViewController = [[MainMenuViewController alloc] initWithNibName:controllerName bundle:nil];
self.uiwindow.rootViewController = self.mainViewController;
- [self.mainViewController release];
[self.uiwindow makeKeyAndVisible];
}
--(void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
+- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
[HWUtils releaseCache];
// don't stop music if it is playing
if ([HWUtils isGameLaunched]) {
@@ -87,7 +81,7 @@
}
// true multitasking with SDL works only on 4.2 and above; we close the game to avoid a black screen at return
--(void) applicationWillResignActive:(UIApplication *)application {
+- (void)applicationWillResignActive:(UIApplication *)application {
if ([HWUtils isGameLaunched] && [[[UIDevice currentDevice] systemVersion] floatValue] < 4.2f)
HW_terminate(NO);
--- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,8 +24,8 @@
UIScrollView *scrollView;
}
-@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
+@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
--(IBAction) dismiss;
+- (IBAction)dismiss;
@end
--- a/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,17 +23,17 @@
@implementation HelpPageLobbyViewController
@synthesize scrollView;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
self.scrollView = nil;
}
// on iPhone the XIBs contain UIScrollView
--(void) viewDidLoad {
+- (void)viewDidLoad {
if (IS_IPAD() == NO){
scrollView.contentSize = CGSizeMake(self.view.frame.size.width, 650);
scrollView.maximumZoomScale = 4.0;
@@ -44,17 +44,7 @@
[super viewDidLoad];
}
--(void) viewDidUnload {
- [super viewDidUnload];
- self.scrollView = nil;
-}
-
--(void) dealloc {
- releaseAndNil(scrollView);
- [super dealloc];
-}
-
--(IBAction) dismiss {
+- (IBAction)dismiss {
[UIView animateWithDuration:0.5 animations:^{
self.view.alpha = 0;
} completion:^(BOOL finished){
--- a/project_files/HedgewarsMobile/Classes/HogHatViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -28,9 +28,9 @@
UIImage *normalHogSprite;
}
-@property (nonatomic,retain) NSDictionary *teamDictionary;
+@property (nonatomic, strong) NSDictionary *teamDictionary;
@property (nonatomic) NSInteger selectedHog;
-@property (nonatomic,retain) NSArray *hatArray;
-@property (nonatomic,retain) UIImage *normalHogSprite;
+@property (nonatomic, strong) NSArray *hatArray;
+@property (nonatomic, strong) UIImage *normalHogSprite;
@end
--- a/project_files/HedgewarsMobile/Classes/HogHatViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HogHatViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@synthesize teamDictionary, hatArray, normalHogSprite, selectedHog;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
// load all the hat file names and store them into hatArray
@@ -41,14 +41,12 @@
// load the base hog image, drawing will occure in cellForRow...
NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/basehat-hedgehog.png",[[NSBundle mainBundle] resourcePath]];
UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile];
- [normalHogFile release];
self.normalHogSprite = hogSprite;
- [hogSprite release];
self.title = NSLocalizedString(@"Change hedgehogs' hat",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// this updates the hog name and its hat
@@ -60,11 +58,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.hatArray count];
}
@@ -75,16 +73,14 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSString *hat = [self.hatArray objectAtIndex:[indexPath row]];
cell.textLabel.text = [hat stringByDeletingPathExtension];
NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@", HATS_DIRECTORY(), hat];
UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)];
- [hatFile release];
cell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, 5)];
- [hatSprite release];
NSDictionary *hog = (self.selectedHog != -1) ? [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:self.selectedHog] : nil;
if ([[hat stringByDeletingPathExtension] isEqualToString:[hog objectForKey:@"hat"]]) {
@@ -99,7 +95,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger selectedRow = [indexPath row];
NSString *newHat = [[self.hatArray objectAtIndex:selectedRow] stringByDeletingPathExtension];
@@ -134,32 +130,16 @@
NSMutableDictionary *newHog = [[NSMutableDictionary alloc] initWithDictionary:oldHog];
[newHog setObject:newHat forKey:@"hat"];
[hogsArray replaceObjectAtIndex:i withObject:newHog];
- [newHog release];
}
}
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.normalHogSprite = nil;
- self.teamDictionary = nil;
- self.hatArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(hatArray);
- releaseAndNil(teamDictionary);
- releaseAndNil(normalHogSprite);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.h Sun Mar 11 20:43:15 2018 +0100
@@ -22,17 +22,17 @@
@protocol HoldTableViewCellDelegate <NSObject>
--(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView;
+- (void)holdAction:(NSString *)content onTable:(UITableView *)aTableView;
@end
@interface HoldTableViewCell : UITableViewCell {
- id<HoldTableViewCellDelegate> delegate;
+ id<HoldTableViewCellDelegate> __weak delegate;
NSTimeInterval time;
}
-@property (nonatomic,assign) id<HoldTableViewCellDelegate> delegate;
+@property (nonatomic, weak) id<HoldTableViewCellDelegate> delegate;
--(void) holdAction;
+- (void)holdAction;
@end
--- a/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/HoldTableViewCell.m Sun Mar 11 20:43:15 2018 +0100
@@ -26,14 +26,14 @@
#define SWIPE_DRAG_HORIZ_MIN 10
#define SWIPE_DRAG_VERT_MAX 40
--(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
delegate = nil;
}
return self;
}
--(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
time = touch.timestamp;
@@ -42,7 +42,7 @@
[super touchesBegan:touches withEvent:event];
}
--(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if ( touch.timestamp - time < 0.25 ) {
@@ -55,7 +55,7 @@
[super touchesCancelled:touches withEvent:event];
}
--(void) holdAction {
+- (void)holdAction {
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)])
{
UITableView *tableView = [self findTable];
@@ -66,9 +66,4 @@
}
}
--(void) dealloc {
- self.delegate = nil;
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/IniParser.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/IniParser.m Sun Mar 11 20:43:15 2018 +0100
@@ -22,10 +22,10 @@
#define SECTION_START_CHAR '['
@interface IniParser ()
-@property (nonatomic, retain) NSString *iniFilePath;
+@property (nonatomic, strong) NSString *iniFilePath;
-@property (nonatomic, retain) NSMutableArray *mutableSections;
-@property (nonatomic, retain) NSMutableDictionary *currentSection;
+@property (nonatomic, strong) NSMutableArray *mutableSections;
+@property (nonatomic, strong) NSMutableDictionary *currentSection;
@end
@implementation IniParser
@@ -85,7 +85,6 @@
- (void)addPreviousSectionToSectionsIfNecessary {
if (self.currentSection != nil) {
[self.mutableSections addObject:self.currentSection];
- [self.currentSection release];
}
}
@@ -110,13 +109,4 @@
return [self.mutableSections copy];
}
-#pragma mark - Dealloc
-
-- (void)dealloc {
- [_iniFilePath release];
- [_mutableSections release];
- [_currentSection release];
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -30,9 +30,9 @@
NSInteger numberOfSections;
}
-@property (nonatomic,retain) NSDictionary *teamDictionary;
-@property (nonatomic,retain) NSArray *levelArray;
-@property (nonatomic,retain) NSArray *levelSprites;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSDictionary *teamDictionary;
+@property (nonatomic, strong) NSArray *levelArray;
+@property (nonatomic, strong) NSArray *levelSprites;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
@end
--- a/project_files/HedgewarsMobile/Classes/LevelViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/LevelViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,13 +23,13 @@
@implementation LevelViewController
@synthesize teamDictionary, levelArray, levelSprites, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
NSArray *array = [[NSArray alloc] initWithObjects:
@@ -40,12 +40,11 @@
NSLocalizedString(@"Weaky",@""),
nil];
self.levelArray = array;
- [array release];
self.title = NSLocalizedString(@"Set difficulty level",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if ([[[[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0] objectForKey:@"level"] intValue] == 0)
@@ -60,11 +59,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return numberOfSections;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return 1;
else
@@ -83,11 +82,10 @@
if (section == 0) {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0];
UISwitch *theSwitch = [[UISwitch alloc] init];
[theSwitch addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = theSwitch;
- [theSwitch release];
}
UISwitch *theSwitch = (UISwitch *)cell.accessoryView;
if (numberOfSections == 1)
@@ -98,7 +96,7 @@
} else {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
cell.textLabel.text = [levelArray objectAtIndex:row];
NSDictionary *hog = [[self.teamDictionary objectForKey:@"hedgehogs"] objectAtIndex:0];
@@ -111,15 +109,13 @@
NSString *botlevelPath = [[NSString alloc] initWithFormat:@"%@/bot%d.png",[[NSBundle mainBundle] resourcePath],row+1];
UIImage *levelImage = [[UIImage alloc] initWithContentsOfFile:botlevelPath];
- [botlevelPath release];
cell.imageView.image = levelImage;
- [levelImage release];
}
return cell;
}
--(void) switchValueChanged:(id) sender {
+- (void)switchValueChanged:(id)sender {
UISwitch *theSwitch = (UISwitch *)sender;
NSIndexSet *sections = [[NSIndexSet alloc] initWithIndex:1];
NSMutableArray *hogs = [self.teamDictionary objectForKey:@"hedgehogs"];
@@ -134,7 +130,6 @@
[self.tableView deleteSections:sections withRowAnimation:UITableViewRowAnimationFade];
level = 0;
}
- [sections release];
DLog(@"New level is %ld", (long)level);
for (NSMutableDictionary *hog in hogs)
@@ -147,7 +142,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (self.lastIndexPath != nil) ? [self.lastIndexPath row] : -1;
@@ -174,29 +169,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.lastIndexPath = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.lastIndexPath = nil;
- self.teamDictionary = nil;
- self.levelArray = nil;
- self.levelSprites = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(levelArray);
- releaseAndNil(levelSprites);
- releaseAndNil(teamDictionary);
- releaseAndNil(lastIndexPath);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.h Sun Mar 11 20:43:15 2018 +0100
@@ -17,6 +17,6 @@
}
@property (nonatomic, readonly) CGRect thumbRect;
-@property (nonatomic, retain) NSString *textValue;
+@property (nonatomic, strong) NSString *textValue;
@end
--- a/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MNEValueTrackingSlider.m Sun Mar 11 20:43:15 2018 +0100
@@ -12,7 +12,7 @@
#pragma mark -
#pragma mark Private UIView subclass rendering the popup showing slider value
@interface SliderValuePopupView : UIView
-@property (nonatomic, retain) UIFont *font;
+@property (nonatomic, strong) UIFont *font;
@property (nonatomic, copy) NSString *text;
@property (nonatomic) float arrowOffset;
@end
@@ -23,7 +23,7 @@
@synthesize text = _text;
@synthesize arrowOffset = _arrowOffset;
--(id) initWithFrame:(CGRect) frame {
+- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.font = [UIFont boldSystemFontOfSize:18];
@@ -31,13 +31,8 @@
return self;
}
--(void) dealloc {
- self.text = nil;
- self.font = nil;
- [super dealloc];
-}
--(void) drawRect:(CGRect) rect {
+- (void)drawRect:(CGRect)rect {
// Create the path for the rounded rectangle
CGRect roundedRect = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, floorf(self.bounds.size.height * 0.8));
UIBezierPath *roundedRectPath = [UIBezierPath bezierPathWithRoundedRect:roundedRect cornerRadius:6.0];
@@ -95,14 +90,14 @@
#pragma mark Private methods
--(void) _constructSlider {
+- (void)_constructSlider {
valuePopupView = [[SliderValuePopupView alloc] initWithFrame:CGRectZero];
valuePopupView.backgroundColor = [UIColor clearColor];
valuePopupView.alpha = 0.0;
[self addSubview:valuePopupView];
}
--(void) _fadePopupViewInAndOut:(BOOL)aFadeIn {
+- (void)_fadePopupViewInAndOut:(BOOL)aFadeIn {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
if (aFadeIn) {
@@ -113,7 +108,7 @@
[UIView commitAnimations];
}
--(void) _positionAndUpdatePopupView {
+- (void)_positionAndUpdatePopupView {
CGRect _thumbRect = self.thumbRect;
CGRect popupRect = CGRectOffset(_thumbRect, 0, -floorf(_thumbRect.size.height * 1.5));
// (-100, -15) determines the size of the the rect
@@ -136,7 +131,7 @@
#pragma mark Memory management
--(id) initWithFrame:(CGRect) frame {
+- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self _constructSlider];
@@ -144,7 +139,7 @@
return self;
}
--(id) initWithCoder:(NSCoder *)aDecoder {
+- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self _constructSlider];
@@ -152,15 +147,10 @@
return self;
}
--(void) dealloc {
- [valuePopupView release];
- [textValue release];
- [super dealloc];
-}
#pragma mark -
#pragma mark UIControl touch event tracking
--(BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
// Fade in and update the popup view
CGPoint touchPoint = [touch locationInView:self];
// Check if the knob is touched. Only in this case show the popup-view
@@ -171,17 +161,17 @@
return [super beginTrackingWithTouch:touch withEvent:event];
}
--(BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
// Update the popup view as slider knob is being moved
[self _positionAndUpdatePopupView];
return [super continueTrackingWithTouch:touch withEvent:event];
}
--(void) cancelTrackingWithEvent:(UIEvent *)event {
+- (void)cancelTrackingWithEvent:(UIEvent *)event {
[super cancelTrackingWithEvent:event];
}
--(void) endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
+- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
// Fade out the popoup view
[self _fadePopupViewInAndOut:NO];
[super endTrackingWithTouch:touch withEvent:event];
--- a/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.h Sun Mar 11 20:43:15 2018 +0100
@@ -20,7 +20,7 @@
// The AVAudioPlayer that the volume fade will be applied to.
// Retained until the fade is completed.
// Must be set with init method.
-@property (nonatomic, retain, readonly) AVAudioPlayer *audioPlayer;
+@property (nonatomic, strong, readonly) AVAudioPlayer *audioPlayer;
// The duration of the volume fade.
// Default value is 1.0
--- a/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m Sun Mar 11 20:43:15 2018 +0100
@@ -10,7 +10,7 @@
#define SKVolumeChangesPerSecond 15
@interface MXAudioPlayerFadeOperation ()
-@property (nonatomic, retain, readwrite) AVAudioPlayer *audioPlayer;
+@property (nonatomic, strong, readwrite) AVAudioPlayer *audioPlayer;
- (void)beginFadeOperation;
- (void)finishFadeOperation;
@end
@@ -31,23 +31,22 @@
- (AVAudioPlayer *)audioPlayer {
AVAudioPlayer *result;
@synchronized(self) {
- result = [_audioPlayer retain];
+ result = _audioPlayer;
}
- return [result autorelease];
+ return result;
}
- (void)setAudioPlayer:(AVAudioPlayer *)anAudioPlayer {
@synchronized(self) {
if (_audioPlayer != anAudioPlayer) {
- [_audioPlayer release];
- _audioPlayer = [anAudioPlayer retain];
+ _audioPlayer = anAudioPlayer;
}
}
}
#pragma mark -
#pragma mark NSOperation
--(id) initFadeWithAudioPlayer:(AVAudioPlayer*)player toVolume:(float)volume overDuration:(NSTimeInterval)duration withDelay:(NSTimeInterval)timeDelay {
+- (id)initFadeWithAudioPlayer:(AVAudioPlayer*)player toVolume:(float)volume overDuration:(NSTimeInterval)duration withDelay:(NSTimeInterval)timeDelay {
if ((self = [super init])) {
self.audioPlayer = player;
[player prepareToPlay];
@@ -125,10 +124,6 @@
if ([self.audioPlayer isPlaying] && _stopAfterFade) [self.audioPlayer stop];
}
-- (void)dealloc {
- releaseAndNil(_audioPlayer);
- [super dealloc];
-}
@end
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -21,6 +21,6 @@
@interface MainMenuViewController : UIViewController <UIAlertViewDelegate>
--(IBAction) switchViews:(id)sender;
+- (IBAction)switchViews:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -50,12 +50,12 @@
@implementation MainMenuViewController
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
--(void) viewDidLoad {
+- (void)viewDidLoad {
self.view.frame = [[UIScreen mainScreen] safeBounds];
[super viewDidLoad];
@@ -108,31 +108,30 @@
- (void) presentViewController:(UIViewController *)vc
{
[self presentViewController:vc animated:NO completion:nil];
- [vc release];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[[AudioManagerController mainManager] playBackgroundMusic];
[super viewWillAppear:animated];
}
#pragma mark -
--(IBAction) switchViews:(id) sender {
+- (IBAction)switchViews:(id)sender {
UIButton *button = (UIButton *)sender;
UIAlertView *alert;
NSString *xib = nil;
[[AudioManagerController mainManager] playClickSound];
switch (button.tag) {
- case 0:
+ case 0: {
xib = IS_IPAD() ? @"GameConfigViewController-iPad" : @"GameConfigViewController-iPhone";
GameConfigViewController *gcvc = [[GameConfigViewController alloc] initWithNibName:xib bundle:nil];
gcvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:gcvc animated:YES completion:nil];
- [gcvc release];
break;
+ }
case 2:
if (IS_IPAD())
{
@@ -140,23 +139,18 @@
SettingsBaseViewController *rightController = [[SettingsBaseViewController alloc] init];
rightController.targetController = nil;
UINavigationController *rightNavController = [[UINavigationController alloc] initWithRootViewController:rightController];
- [rightController release];
// the contens on the left of the splitview, setting targetController that will receive push/pop actions
SettingsBaseViewController *leftController = [[SettingsBaseViewController alloc] init];
leftController.targetController = rightNavController.topViewController;
UINavigationController *leftNavController = [[UINavigationController alloc] initWithRootViewController:leftController];
- [leftController release];
MGSplitViewController *splitViewRootController = [[MGSplitViewController alloc] init];
splitViewRootController.delegate = nil;
splitViewRootController.showsMasterInPortrait = YES;
splitViewRootController.viewControllers = [NSArray arrayWithObjects:leftNavController, rightNavController, nil];
- [leftNavController release];
- [rightNavController release];
[self presentViewController:splitViewRootController animated:YES completion:nil];
- [splitViewRootController release];
}
else
{
@@ -165,44 +159,32 @@
UIViewController *generalSettingsViewController = [[GeneralSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
generalSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"General",@"") imageName:@"flower" selectedImageName:@"flower_filled"];
UINavigationController *generalNavController = [[UINavigationController alloc] initWithRootViewController:generalSettingsViewController];
- [generalSettingsViewController release];
[tabBarNavigationControllers addObject:generalNavController];
- [generalNavController release];
UIViewController *teamSettingsViewController = [[TeamSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
teamSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Teams",@"") imageName:@"teams" selectedImageName:@"teams_filled"];
UINavigationController *teamNavController = [[UINavigationController alloc] initWithRootViewController:teamSettingsViewController];
- [teamSettingsViewController release];
[tabBarNavigationControllers addObject:teamNavController];
- [teamNavController release];
UIViewController *weaponSettingsViewController = [[WeaponSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
weaponSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Weapons",@"") imageName:@"bullet" selectedImageName:@"bullet_filled"];
UINavigationController *weaponNavController = [[UINavigationController alloc] initWithRootViewController:weaponSettingsViewController];
- [weaponSettingsViewController release];
[tabBarNavigationControllers addObject:weaponNavController];
- [weaponNavController release];
UIViewController *schemeSettingsViewController = [[SchemeSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped];
schemeSettingsViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Schemes",@"") imageName:@"target" selectedImageName:@"target_filled"];
UINavigationController *schemeNavController = [[UINavigationController alloc] initWithRootViewController:schemeSettingsViewController];
- [schemeSettingsViewController release];
[tabBarNavigationControllers addObject:schemeNavController];
- [schemeNavController release];
UIViewController *supportViewController = [[SupportViewController alloc] initWithStyle:UITableViewStyleGrouped];
supportViewController.tabBarItem = [self tabBarItemWithTitle:NSLocalizedString(@"Support",@"") imageName:@"heart" selectedImageName:@"heart_filled"];
UINavigationController *supportNavController = [[UINavigationController alloc] initWithRootViewController:supportViewController];
- [supportViewController release];
[tabBarNavigationControllers addObject:supportNavController];
- [supportNavController release];
UITabBarController *settingsTabController = [[UITabBarController alloc] init];
settingsTabController.viewControllers = tabBarNavigationControllers;
- [tabBarNavigationControllers release];
[self presentViewController:settingsTabController animated:YES completion:nil];
- [settingsTabController release];
}
break;
case 3:
@@ -210,10 +192,8 @@
{
GameLogViewController *gameLogVC = [[GameLogViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:gameLogVC];
- [gameLogVC release];
[self presentViewController:navController animated:YES completion:nil];
- [navController release];
}
#else
{
@@ -222,7 +202,6 @@
about.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:about animated:YES completion:nil];
- [about release];
}
#endif
break;
@@ -233,7 +212,6 @@
savedgames.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:savedgames animated:YES completion:nil];
- [savedgames release];
}
break;
case 5:
@@ -244,36 +222,34 @@
missions.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:missions animated:YES completion:nil];
- [missions release];
}
break;
- case 6:
+ case 6: {
[GameInterfaceBridge registerCallingController:self];
[GameInterfaceBridge startSimpleGame];
break;
+ }
case 7:
{
xib = IS_IPAD() ? @"CampaignsViewController-iPad" : @"CampaignsViewController-iPhone";
CampaignsViewController *campaigns = [[CampaignsViewController alloc] initWithNibName:xib bundle:nil];
UINavigationController *campaignNavigationController = [[UINavigationController alloc] initWithRootViewController:campaigns];
- [campaigns release];
campaignNavigationController.modalTransitionStyle = IS_IPAD() ? UIModalTransitionStyleCoverVertical : UIModalTransitionStyleCrossDissolve;
campaignNavigationController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:campaignNavigationController animated:YES completion:nil];
- [campaignNavigationController release];
}
break;
- default:
+ default: {
alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
message:@"Sorry, this feature is not yet implemented"
delegate:nil
cancelButtonTitle:@"Well, don't worry"
otherButtonTitles:nil];
[alert show];
- [alert release];
break;
+ }
}
}
@@ -281,27 +257,16 @@
imageName: (NSString *)imageName
selectedImageName: (NSString *)selectedImageName
{
- return [[[UITabBarItem alloc] initWithTitle:title
+ return [[UITabBarItem alloc] initWithTitle:title
image:[UIImage imageNamed:imageName]
- selectedImage:[UIImage imageNamed:selectedImageName]] autorelease];
+ selectedImage:[UIImage imageNamed:selectedImageName]];
}
#pragma mark -
--(void) viewDidUnload {
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) dealloc {
- [_simpleGameButton release];
- [_missionsButton release];
- [_campaignButton release];
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -54,32 +54,32 @@
@property (nonatomic,assign) NSInteger oldPage;
@property (nonatomic,assign) BOOL busy;
@property (nonatomic,assign) NSInteger maxHogs;
-@property (nonatomic,retain) NSString *seedCommand;
-@property (nonatomic,retain) NSString *templateFilterCommand;
-@property (nonatomic,retain) NSString *mapGenCommand;
-@property (nonatomic,retain) NSString *mazeSizeCommand;
-@property (nonatomic,retain) NSString *themeCommand;
-@property (nonatomic,retain) NSString *staticMapCommand;
-@property (nonatomic,retain) NSString *missionCommand;
+@property (nonatomic, strong) NSString *seedCommand;
+@property (nonatomic, strong) NSString *templateFilterCommand;
+@property (nonatomic, strong) NSString *mapGenCommand;
+@property (nonatomic, strong) NSString *mazeSizeCommand;
+@property (nonatomic, strong) NSString *themeCommand;
+@property (nonatomic, strong) NSString *staticMapCommand;
+@property (nonatomic, strong) NSString *missionCommand;
-@property (nonatomic,retain) IBOutlet MapPreviewButtonView *previewButton;
-@property (nonatomic,retain) IBOutlet UITableView *tableView;
-@property (nonatomic,retain) IBOutlet UILabel *maxLabel;
-@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;
-@property (nonatomic,retain) IBOutlet MNEValueTrackingSlider *slider;
+@property (nonatomic, strong) IBOutlet MapPreviewButtonView *previewButton;
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet UILabel *maxLabel;
+@property (nonatomic, strong) IBOutlet UISegmentedControl *segmentedControl;
+@property (nonatomic, strong) IBOutlet MNEValueTrackingSlider *slider;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
-@property (nonatomic,retain) NSArray *dataSourceArray;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSArray *dataSourceArray;
--(IBAction) mapButtonPressed:(id) sender;
--(IBAction) sliderChanged:(id) sender;
--(IBAction) sliderEndedChanging:(id) sender;
--(IBAction) segmentedControlChanged:(id) sender;
+- (IBAction)mapButtonPressed:(id)sender;
+- (IBAction)sliderChanged:(id)sender;
+- (IBAction)sliderEndedChanging:(id)sender;
+- (IBAction)segmentedControlChanged:(id)sender;
--(void) turnOnWidgets;
--(void) turnOffWidgets;
--(void) setMaxLabelText:(NSString *)str;
--(void) updatePreview;
+- (void)turnOnWidgets;
+- (void)turnOffWidgets;
+- (void)setMaxLabelText:(NSString *)str;
+- (void)updatePreview;
@end
--- a/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapConfigViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -30,16 +30,16 @@
oldPage, oldValue;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(IBAction) mapButtonPressed:(id) sender {
+- (IBAction)mapButtonPressed:(id)sender {
[[AudioManagerController mainManager] playClickSound];
[self updatePreview];
}
--(void) updatePreview {
+- (void)updatePreview {
// don't generate a new preview while it's already generating one
if (self.busy)
return;
@@ -48,7 +48,6 @@
NSString *seed = [HWUtils seed];
NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
self.seedCommand = seedCmd;
- [seedCmd release];
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
if (isRandomness()) {
@@ -57,7 +56,6 @@
[self.previewButton updatePreviewWithSeed:seed];
// the preview for static maps is loaded in didSelectRowAtIndexPath
}
- [seed release];
// perform as if user clicked on an entry
NSIndexPath *theIndex = [NSIndexPath indexPathForRow:arc4random_uniform((int)[source count]) inSection:0];
@@ -66,7 +64,7 @@
[self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}
--(void) turnOffWidgets {
+- (void)turnOffWidgets {
busy = YES;
self.previewButton.alpha = 0.5f;
self.previewButton.enabled = NO;
@@ -77,7 +75,7 @@
#pragma mark -
#pragma mark MapPreviewButtonView delegate methods
--(void) turnOnWidgets {
+- (void)turnOnWidgets {
self.previewButton.alpha = 1.0f;
self.previewButton.enabled = YES;
self.segmentedControl.enabled = YES;
@@ -85,12 +83,12 @@
self.busy = NO;
}
--(void) setMaxLabelText:(NSString *)str {
+- (void)setMaxLabelText:(NSString *)str {
self.maxHogs = [str intValue];
self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str];
}
--(NSDictionary *)getDataForEngine {
+- (NSDictionary *)getDataForEngine {
NSDictionary *dictForEngine = [NSDictionary dictionaryWithObjectsAndKeys:
self.seedCommand,@"seedCommand",
self.templateFilterCommand,@"templateFilterCommand",
@@ -102,11 +100,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section {
+- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
return [[self.dataSourceArray objectAtIndex:scIndex] count];
}
@@ -116,7 +114,7 @@
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
@@ -130,14 +128,12 @@
if (isRandomness()) {
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]];
cell.imageView.image = image;
- [image release];
} else
cell.imageView.image = nil;
if (row == [self.lastIndexPath row]) {
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
cell.accessoryView = checkbox;
- [checkbox release];
} else
cell.accessoryView = nil;
@@ -146,15 +142,13 @@
}
// this set details for a static map (called by didSelectRowAtIndexPath)
--(void) setDetailsForStaticMap:(NSInteger) index {
+- (void)setDetailsForStaticMap:(NSInteger)index {
NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg",
(scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
- [fileCfg release];
NSArray *split = [contents componentsSeparatedByString:@"\n"];
- [contents release];
// if the number is not set we keep 18 standard;
// sometimes it's not set but there are trailing characters, we get around them with the second equation
@@ -176,7 +170,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -195,7 +189,6 @@
UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
newCell.accessoryView = checkbox;
- [checkbox release];
UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath];
oldCell.accessoryView = nil;
@@ -209,7 +202,7 @@
#pragma mark slider & segmentedControl & button
// this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
// no methods are called by this routine and you can pass nil to it
--(IBAction) sliderChanged:(id) sender {
+- (IBAction)sliderChanged:(id)sender {
NSString *labelText;
NSString *templateCommand;
NSString *mazeCommand;
@@ -282,7 +275,7 @@
}
// update preview (if not busy and if its value really changed) as soon as the user lifts its finger up
--(IBAction) sliderEndedChanging:(id) sender {
+- (IBAction)sliderEndedChanging:(id)sender {
int num = (int) (self.slider.value * 100);
if (oldValue != num) {
[self updatePreview];
@@ -293,7 +286,7 @@
// perform actions based on the activated section, then call updatePreview to visually update the selection
// and if necessary update the table with a slide animation
--(IBAction) segmentedControlChanged:(id) sender {
+- (IBAction)segmentedControlChanged:(id)sender {
NSString *mapgen, *staticmap, *mission;
NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
@@ -372,7 +365,6 @@
NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName];
if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath])
[themeArray addObject:themeName];
- [checkPath release];
}
// remove images that are too big for certain devices without loading the whole image
@@ -398,17 +390,13 @@
[missionArray addObject:str];
}
NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
- [missionArray release];
- [themeArray release];
- [mapArray release];
self.dataSourceArray = array;
- [array release];
}
return dataSourceArray;
}
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
[self localizeSegmentedControl];
@@ -436,44 +424,21 @@
UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f];
backLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[self.view insertSubview:backLabel belowSubview:self.segmentedControl];
- [backLabel release];
}
self.tableView.separatorColor = [UIColor whiteColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
--(void) viewDidAppear:(BOOL) animated {
+- (void)viewDidAppear:(BOOL) animated {
[self updatePreview];
[super viewDidAppear:animated];
}
--(void) viewDidUnload {
- self.previewButton = nil;
- self.seedCommand = nil;
- self.templateFilterCommand = nil;
- self.mapGenCommand = nil;
- self.mazeSizeCommand = nil;
- self.themeCommand = nil;
- self.staticMapCommand = nil;
- self.missionCommand = nil;
-
- self.tableView = nil;
- self.maxLabel = nil;
- self.segmentedControl = nil;
- self.slider = nil;
-
- self.lastIndexPath = nil;
- self.dataSourceArray = nil;
-
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
self.dataSourceArray = nil;
[super didReceiveMemoryWarning];
@@ -487,25 +452,4 @@
MSG_MEMCLEAN();
}
--(void) dealloc {
- releaseAndNil(seedCommand);
- releaseAndNil(templateFilterCommand);
- releaseAndNil(mapGenCommand);
- releaseAndNil(mazeSizeCommand);
- releaseAndNil(themeCommand);
- releaseAndNil(staticMapCommand);
- releaseAndNil(missionCommand);
-
- releaseAndNil(previewButton);
- releaseAndNil(tableView);
- releaseAndNil(maxLabel);
- releaseAndNil(segmentedControl);
- releaseAndNil(slider);
-
- releaseAndNil(lastIndexPath);
- releaseAndNil(dataSourceArray);
-
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.h Sun Mar 11 20:43:15 2018 +0100
@@ -23,25 +23,25 @@
@protocol MapPreviewViewDelegate <NSObject>
--(void) turnOnWidgets;
--(void) setMaxLabelText:(NSString *)string;
--(NSDictionary *)getDataForEngine;
+- (void)turnOnWidgets;
+- (void)setMaxLabelText:(NSString *)string;
+- (NSDictionary *)getDataForEngine;
@end
@interface MapPreviewButtonView : UIButton {
- id<MapPreviewViewDelegate> delegate;
+ id<MapPreviewViewDelegate> __weak delegate;
TCPsocket sd, csd;
NSInteger maxHogs;
}
-@property (nonatomic,assign) id<MapPreviewViewDelegate> delegate;
+@property (nonatomic,weak) id<MapPreviewViewDelegate> delegate;
--(void) setImageRounded:(UIImage *)image forState:(UIControlState) controlState;
--(void) setImageRounded:(UIImage *)image;
--(void) updatePreviewWithSeed:(NSString *)seed;
--(void) updatePreviewWithFile:(NSString *)filePath;
--(void) turnOnWidgets;
--(NSDictionary *)getDataForEngine;
+- (void)setImageRounded:(UIImage *)image forState:(UIControlState)controlState;
+- (void)setImageRounded:(UIImage *)image;
+- (void)updatePreviewWithSeed:(NSString *)seed;
+- (void)updatePreviewWithFile:(NSString *)filePath;
+- (void)turnOnWidgets;
+- (NSDictionary *)getDataForEngine;
@end
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m Sun Mar 11 20:43:15 2018 +0100
@@ -31,7 +31,7 @@
@implementation MapPreviewButtonView
@synthesize delegate;
--(id) initWithFrame:(CGRect)frame {
+- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
delegate = nil;
self.backgroundColor = [UIColor whiteColor];
@@ -40,18 +40,13 @@
return self;
}
--(void) dealloc {
- self.delegate = nil;
- [super dealloc];
-}
-
#pragma mark -
#pragma mark image wrappers
--(void) setImageRounded:(UIImage *)image forState:(UIControlState)controlState {
+- (void)setImageRounded:(UIImage *)image forState:(UIControlState)controlState {
[self setImage:[image makeRoundCornersOfSize:CGSizeMake(12, 12)] forState:controlState];
}
--(void) setImageRounded:(UIImage *)image {
+- (void)setImageRounded:(UIImage *)image {
[self setImageRounded:image forState:UIControlStateNormal];
}
@@ -64,7 +59,7 @@
return SDLNet_TCP_Send(csd, [string UTF8String], length);
}
--(void) engineProtocol:(uint8_t *)unpackedMap {
+- (void)engineProtocol:(uint8_t *)unpackedMap {
IPaddress ip;
BOOL serverQuit = NO;
uint8_t packedMap[128*32];
@@ -98,13 +93,11 @@
@"--user-prefix", documentsDirectory,
@"--landpreview",
nil];
- [ipcString release];
int argc = [gameParameters count];
const char **argv = (const char **)malloc(sizeof(const char*)*argc);
for (int i = 0; i < argc; i++)
argv[i] = strdup([[gameParameters objectAtIndex:i] UTF8String]);
- [gameParameters release];
RunEngine(argc, argv);
@@ -154,7 +147,7 @@
return;
}
--(void) drawingThread {
+- (void)drawingThread {
@autoreleasepool {
uint8_t unpackedMap[128*32*8];
@@ -174,7 +167,6 @@
[self performSelectorOnMainThread:@selector(setImageRounded:)
withObject:previewImage
waitUntilDone:NO];
- [previewImage release];
[self performSelectorOnMainThread:@selector(setLabelText:)
withObject:[NSString stringWithFormat:@"%ld", (long)maxHogs]
waitUntilDone:NO];
@@ -188,7 +180,7 @@
}
}
--(void) updatePreviewWithSeed:(NSString *)seed {
+- (void)updatePreviewWithSeed:(NSString *)seed {
// remove the current preview and title
[self setImage:nil forState:UIControlStateNormal];
[self setTitle:nil forState:UIControlStateNormal];
@@ -205,22 +197,20 @@
indicator.tag = INDICATOR_TAG;
[indicator startAnimating];
[self addSubview:indicator];
- [indicator release];
// let's draw in a separate thread so the gui can work; at the end it restore other widgets
[NSThread detachNewThreadSelector:@selector(drawingThread) toTarget:self withObject:nil];
}
}
--(void) updatePreviewWithFile:(NSString *)filePath {
+- (void)updatePreviewWithFile:(NSString *)filePath {
UIImage *image = [[UIImage alloc] initWithContentsOfFile:filePath];
[self setImageRounded:image forState:UIControlStateNormal];
self.backgroundColor = [UIColor whiteColor];
self.layer.cornerRadius = 12;
- [image release];
}
--(void) removeIndicator {
+- (void)removeIndicator {
UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self viewWithTag:INDICATOR_TAG];
if (indicator) {
[indicator stopAnimating];
@@ -230,17 +220,17 @@
#pragma mark -
#pragma mark delegate
--(void) turnOnWidgets {
+- (void)turnOnWidgets {
if ([self.delegate respondsToSelector:@selector(turnOnWidgets)])
[self.delegate turnOnWidgets];
}
--(void) setLabelText:(NSString *)string {
+- (void)setLabelText:(NSString *)string {
if ([self.delegate respondsToSelector:@selector(setMaxLabelText:)])
[self.delegate setMaxLabelText:string];
}
--(NSDictionary *)getDataForEngine {
+- (NSDictionary *)getDataForEngine {
if ([self.delegate respondsToSelector:@selector(getDataForEngine)])
return [self.delegate getDataForEngine];
return nil;
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -22,14 +22,14 @@
@interface MissionTrainingViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
-@property (nonatomic, retain) NSArray *listOfMissionIDs;
-@property (nonatomic, retain) NSDictionary *dictOfMissions;
-@property (nonatomic, retain) NSString *missionName;
+@property (nonatomic, strong) NSArray *listOfMissionIDs;
+@property (nonatomic, strong) NSDictionary *dictOfMissions;
+@property (nonatomic, strong) NSString *missionName;
-@property (nonatomic, retain) IBOutlet UIImageView *previewImage;
-@property (nonatomic, retain) IBOutlet UITableView *tableView;
-@property (nonatomic, retain) IBOutlet UILabel *descriptionLabel;
+@property (nonatomic, strong) IBOutlet UIImageView *previewImage;
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet UILabel *descriptionLabel;
--(IBAction) buttonPressed:(id) sender;
+- (IBAction)buttonPressed:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/MissionTrainingViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@implementation MissionTrainingViewController
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View management
--(void) viewDidLoad
+- (void)viewDidLoad
{
[super viewDidLoad];
@@ -54,14 +54,14 @@
self.descriptionLabel.textColor = [UIColor lightYellowColor];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:arc4random_uniform((int)[self.listOfMissionIDs count]) inSection:0];
[self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
[self tableView:self.tableView didSelectRowAtIndexPath:indexPath];
[super viewWillAppear:animated];
}
--(IBAction) buttonPressed:(id) sender {
+- (IBAction)buttonPressed:(id)sender {
UIButton *button = (UIButton *)sender;
if (button.tag == 0) {
@@ -87,8 +87,6 @@
NSDictionary *missionsDict = [self newMissionsDictionaryFromMissionsFile:missionsDescLocation];
NSDictionary *localizedMissionsDict = [self newMissionsDictionaryFromMissionsFile:localizedMissionsDescLocation];
- [missionsDescLocation release];
- [localizedMissionsDescLocation release];
NSMutableDictionary *tempMissionsDict = [[NSMutableDictionary alloc] init];
@@ -104,8 +102,6 @@
}
}
- [missionsDict release];
- [localizedMissionsDict release];
return tempMissionsDict;
}
@@ -113,8 +109,6 @@
{
NSDictionary *missionsDict = [self newMissionsDictionaryFromMissionsFile:missionsDescLocation];
- [missionsDescLocation release];
- [localizedMissionsDescLocation release];
return missionsDict;
}
@@ -126,7 +120,6 @@
NSString *missionsFileContents = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSArray *missionsLines = [missionsFileContents componentsSeparatedByString:@"\n"];
- [missionsFileContents release];
for (NSString *line in missionsLines)
{
@@ -151,7 +144,6 @@
{
NSMutableDictionary *missionDict = [[NSMutableDictionary alloc] init];
[missionsDict setObject:missionDict forKey:missionID];
- [missionDict release];
}
NSMutableDictionary *missionDict = [missionsDict objectForKey:missionID];
@@ -200,11 +192,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.listOfMissionIDs count];
}
@@ -218,8 +210,8 @@
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:(IS_IPAD()) ? UITableViewCellStyleDefault : UITableViewCellStyleSubtitle
- reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:(IS_IPAD()) ? UITableViewCellStyleDefault : UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier];
NSString *missionID = [self.listOfMissionIDs objectAtIndex:row];
cell.textLabel.text = self.dictOfMissions[missionID][@"name"];
@@ -240,7 +232,6 @@
bgColorView.backgroundColor = [UIColor colorWithRed:(85.0/255.0) green:(15.0/255.0) blue:(106.0/255.0) alpha:1.0];
bgColorView.layer.masksToBounds = YES;
cell.selectedBackgroundView = bgColorView;
- [bgColorView release];
cell.backgroundColor = [UIColor blackColorTransparent];
return cell;
@@ -248,16 +239,14 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
self.missionName = [self.listOfMissionIDs objectAtIndex:row];
NSString *size = IS_IPAD() ? @"@2x" : @"";
NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Missions/Training/%@%@.png",GRAPHICS_DIRECTORY(),self.missionName,size];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:filePath];
- [filePath release];
[self.previewImage setImage:img];
- [img release];
self.descriptionLabel.text = self.dictOfMissions[self.missionName][@"desc"];
}
@@ -265,7 +254,7 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning
+- (void)didReceiveMemoryWarning
{
self.missionName = nil;
self.listOfMissionIDs = nil;
@@ -275,29 +264,4 @@
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload
-{
- self.listOfMissionIDs = nil;
- self.dictOfMissions = nil;
- self.previewImage = nil;
- self.tableView = nil;
- self.descriptionLabel = nil;
- self.missionName = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
-
--(void) dealloc
-{
- releaseAndNil(_listOfMissionIDs);
- releaseAndNil(_dictOfMissions);
- releaseAndNil(_previewImage);
- releaseAndNil(_tableView);
- releaseAndNil(_descriptionLabel);
- releaseAndNil(_missionName);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m Sun Mar 11 20:43:15 2018 +0100
@@ -50,7 +50,6 @@
UIViewAutoresizingFlexibleBottomMargin;
[overlay_instance.loadingIndicator startAnimating];
[overlay_instance.view addSubview:overlay_instance.loadingIndicator];
- [overlay_instance.loadingIndicator release];
*/
}
--- a/project_files/HedgewarsMobile/Classes/RestoreViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
}
--(IBAction) buttonReleased:(id) sender;
+- (IBAction)buttonReleased:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/RestoreViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -21,17 +21,17 @@
#import "GameInterfaceBridge.h"
@interface RestoreViewController ()
-@property (retain, nonatomic) IBOutlet UIButton *restoreButton;
-@property (retain, nonatomic) IBOutlet UIButton *dismissButton;
+@property (strong, nonatomic) IBOutlet UIButton *restoreButton;
+@property (strong, nonatomic) IBOutlet UIButton *dismissButton;
@end
@implementation RestoreViewController
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(IBAction) buttonReleased:(id) sender {
+- (IBAction)buttonReleased:(id)sender {
UIButton *theButton = (UIButton *)sender;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -54,7 +54,7 @@
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
[self.restoreButton setTitle:NSLocalizedString(@"Restore", nil) forState:UIControlStateNormal];
@@ -64,19 +64,12 @@
[self.dismissButton applyDarkBlueQuickStyle];
}
--(void) didReceiveMemoryWarning {
+#pragma mark -
+#pragma mark Memory Management
+
+- (void)didReceiveMemoryWarning {
+ MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- [super viewDidUnload];
-}
-
--(void) dealloc {
- [_restoreButton release];
- [_dismissButton release];
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -26,9 +26,9 @@
NSMutableArray *listOfSavegames;
}
-@property (nonatomic,retain) IBOutlet UITableView *tableView;
-@property (nonatomic,retain) NSMutableArray *listOfSavegames;
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) NSMutableArray *listOfSavegames;
--(IBAction) buttonPressed:(id) sender;
+- (IBAction)buttonPressed:(id)sender;
@end
--- a/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SavedGamesViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -21,26 +21,25 @@
#import "GameInterfaceBridge.h"
@interface SavedGamesViewController ()
-@property (retain, nonatomic) IBOutlet UIBarButtonItem *clearAllButton;
+@property (strong, nonatomic) IBOutlet UIBarButtonItem *clearAllButton;
@end
@implementation SavedGamesViewController
@synthesize tableView, listOfSavegames;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(void) updateTable {
+- (void)updateTable {
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];
}
--(void) viewDidLoad
+- (void)viewDidLoad
{
[super viewDidLoad];
@@ -49,11 +48,9 @@
NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
UIImageView *background = [[UIImageView alloc] initWithImage:img];
- [img release];
background.frame = self.view.frame;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:background atIndex:0];
- [background release];
[self.clearAllButton setTitle:NSLocalizedString(@"Clear All", nil)];
@@ -61,14 +58,14 @@
[self updateTable];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[self updateTable];
[super viewWillAppear:animated];
}
#pragma mark -
#pragma mark button functions
--(IBAction) buttonPressed:(id) sender {
+- (IBAction)buttonPressed:(id)sender {
UIButton *button = (UIButton *)sender;
if (button.tag == 0) {
@@ -91,11 +88,10 @@
[actionSheet showFromBarButtonItem:(UIBarButtonItem *)sender animated:YES];
else
[actionSheet showInView:self.view];
- [actionSheet release];
}
}
--(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger) buttonIndex {
+- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if ([actionSheet cancelButtonIndex] != buttonIndex) {
// remove all files and recreate the directory
[[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
@@ -108,17 +104,16 @@
[self.listOfSavegames removeAllObjects];
[self.tableView deleteRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationTop];
- [array release];
}
}
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.listOfSavegames count];
}
@@ -127,7 +122,7 @@
EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (editableCell == nil) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
editableCell.delegate = nil;
editableCell.textField.userInteractionEnabled = NO;
}
@@ -138,7 +133,7 @@
return (UITableViewCell *)editableCell;
}
--(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 60)];
footer.backgroundColor = [UIColor clearColor];
@@ -152,15 +147,14 @@
label.backgroundColor = [UIColor clearColor];
[footer addSubview:label];
- [label release];
- return [footer autorelease];
+ return footer;
}
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 60;
}
--(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[(EditableCellView *)[self.tableView cellForRowAtIndexPath:indexPath] save:nil];
[self fixTagsForStartTag:[indexPath row]];
@@ -189,7 +183,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.listOfSavegames == nil)
[self updateTable];
@@ -203,21 +197,18 @@
NSString *newFilePath = [[NSString alloc] initWithFormat:@"%@/%@",SAVES_DIRECTORY(),newSaveName];
[self.listOfSavegames addObject:newSaveName];
- [newSaveName release];
[[NSFileManager defaultManager] copyItemAtPath:currentFilePath toPath:newFilePath error:nil];
- [newFilePath release];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
[GameInterfaceBridge registerCallingController:self];
[GameInterfaceBridge startSaveGame:currentFilePath];
- [currentFilePath release];
}
#pragma mark -
#pragma mark editableCellView delegate
// rename old file if names differ
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue {
if (self.listOfSavegames == nil)
[self updateTable];
NSString *oldFilePath = [NSString stringWithFormat:@"%@/%@",SAVES_DIRECTORY(),[self.listOfSavegames objectAtIndex:tagValue]];
@@ -232,24 +223,11 @@
#pragma mark -
#pragma mark Memory Management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.listOfSavegames = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.tableView = nil;
- self.listOfSavegames = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(tableView);
- releaseAndNil(listOfSavegames);
- releaseAndNil(_clearAllButton);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
NSMutableArray *listOfSchemes;
}
-@property (nonatomic, retain) NSMutableArray *listOfSchemes;
+@property (nonatomic, strong) NSMutableArray *listOfSchemes;
@end
--- a/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SchemeSettingsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@implementation SchemeSettingsViewController
@synthesize listOfSchemes;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"")
@@ -38,24 +38,22 @@
target:self
action:@selector(toggleEdit:)];
self.navigationItem.rightBarButtonItem = editButton;
- [editButton release];
self.navigationItem.title = NSLocalizedString(@"List of schemes", nil);
}
--(void) viewWillAppear:(BOOL) animated {
+- (void)viewWillAppear:(BOOL) animated {
[super viewWillAppear:animated];
NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCHEMES_DIRECTORY() error:NULL];
NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
self.listOfSchemes = array;
- [array release];
[self.tableView reloadData];
}
// modifies the navigation bar to add the "Add" and "Done" buttons
--(void) toggleEdit:(id) sender {
+- (void)toggleEdit:(id)sender {
BOOL isEditing = self.tableView.editing;
[self.tableView setEditing:!isEditing animated:YES];
@@ -71,11 +69,10 @@
target:self
action:@selector(addScheme:)];
self.navigationItem.leftBarButtonItem = addButton;
- [addButton release];
}
}
--(void) addScheme:(id) sender {
+- (void)addScheme:(id)sender {
NSString *fileName = [[NSString alloc] initWithFormat:@"Scheme %u.plist", [self.listOfSchemes count]];
[CreationChamber createSchemeNamed:[fileName stringByDeletingPathExtension]];
@@ -88,7 +85,6 @@
NSInteger index = [self.listOfSchemes indexOfObject:fileName];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
- [fileName release];
}
#pragma mark -
@@ -106,7 +102,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSUInteger row = [indexPath row];
@@ -118,12 +114,11 @@
}
// delete the row and the file
--(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
[[NSFileManager defaultManager] removeItemAtPath:schemeFile error:NULL];
- [schemeFile release];
[self.listOfSchemes removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
@@ -131,7 +126,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SingleSchemeViewController *singleSchemeViewController = [[SingleSchemeViewController alloc] initWithStyle:UITableViewStyleGrouped];
@@ -143,7 +138,6 @@
[singleSchemeViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
[self.navigationController pushViewController:singleSchemeViewController animated:YES];
- [singleSchemeViewController release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@@ -151,26 +145,12 @@
#pragma mark -
#pragma mark Memory management
+
-(void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
MSG_MEMCLEAN();
}
--(void) viewDidUnload
-{
- self.listOfSchemes = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
-
--(void) dealloc
-{
- releaseAndNil(listOfSchemes);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -38,20 +38,20 @@
BOOL sectionsHidden;
}
-@property (nonatomic,retain) NSArray *listOfSchemes;
-@property (nonatomic,retain) NSArray *listOfWeapons;
-@property (nonatomic,retain) NSArray *listOfScripts;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath_sc;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath_we;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath_lu;
-@property (nonatomic,retain) NSString *selectedScheme;
-@property (nonatomic,retain) NSString *selectedWeapon;
-@property (nonatomic,retain) NSString *selectedScript;
-@property (nonatomic,retain) NSString *scriptCommand;
-@property (nonatomic,retain) UISegmentedControl *topControl;
-@property (nonatomic,assign) BOOL sectionsHidden;
+@property (nonatomic, strong) NSArray *listOfSchemes;
+@property (nonatomic, strong) NSArray *listOfWeapons;
+@property (nonatomic, strong) NSArray *listOfScripts;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath_sc;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath_we;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath_lu;
+@property (nonatomic, strong) NSString *selectedScheme;
+@property (nonatomic, strong) NSString *selectedWeapon;
+@property (nonatomic, strong) NSString *selectedScript;
+@property (nonatomic, strong) NSString *scriptCommand;
+@property (nonatomic, strong) UISegmentedControl *topControl;
+@property (assign) BOOL sectionsHidden;
--(void) fillSections;
--(void) emptySections;
+- (void)fillSections;
+- (void)emptySections;
@end
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -29,7 +29,7 @@
@synthesize listOfSchemes, listOfWeapons, listOfScripts, lastIndexPath_sc, lastIndexPath_we, lastIndexPath_lu,
selectedScheme, selectedWeapon, selectedScript, scriptCommand, topControl, sectionsHidden;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
@@ -85,19 +85,17 @@
NSLocalizedString(@"Weapon",@""),
NSLocalizedString(@"Style",@""),nil];
UISegmentedControl *controller = [[UISegmentedControl alloc] initWithItems:array];
- [array release];
controller.segmentedControlStyle = UISegmentedControlStyleBar;
controller.tintColor = [UIColor lightGrayColor];
controller.selectedSegmentIndex = 0;
self.topControl = controller;
- [controller release];
}
return topControl;
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
self.sectionsHidden = NO;
NSInteger topOffset = IS_IPAD() ? 45 : 0;
@@ -116,7 +114,6 @@
withBorderWidth:2.7f];
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:background atIndex:0];
- [background release];
self.topControl.frame = CGRectMake(0, 4, self.view.frame.size.width * 80/100, 30);
self.topControl.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
@@ -128,9 +125,7 @@
UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
background.contentMode = UIViewContentModeScaleAspectFill;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- [backgroundImage release];
[self.view addSubview:background];
- [background release];
[aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
}
@@ -140,7 +135,6 @@
aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
aTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:aTableView];
- [aTableView release];
[super viewDidLoad];
@@ -157,11 +151,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)aTableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
return (self.sectionsHidden ? 0 : 1);
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (self.topControl.selectedSegmentIndex == 0)
return [self.listOfSchemes count];
else if (self.topControl.selectedSegmentIndex == 1)
@@ -178,7 +172,7 @@
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
cell.accessoryView = nil;
if (0 == index) {
@@ -186,11 +180,9 @@
NSString *str = [NSString stringWithFormat:@"%@/%@",SCHEMES_DIRECTORY(),[self.listOfSchemes objectAtIndex:row]];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
cell.detailTextLabel.text = [dict objectForKey:@"description"];
- [dict release];
if ([[self.listOfSchemes objectAtIndex:row] isEqualToString:self.selectedScheme]) {
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
cell.accessoryView = checkbox;
- [checkbox release];
self.lastIndexPath_sc = indexPath;
}
} else if (1 == index) {
@@ -198,11 +190,9 @@
NSString *str = [NSString stringWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
cell.detailTextLabel.text = [dict objectForKey:@"description"];
- [dict release];
if ([[self.listOfWeapons objectAtIndex:row] isEqualToString:self.selectedWeapon]) {
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
cell.accessoryView = checkbox;
- [checkbox release];
self.lastIndexPath_we = indexPath;
}
} else {
@@ -214,7 +204,6 @@
{
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
cell.accessoryView = checkbox;
- [checkbox release];
self.lastIndexPath_lu = indexPath;
}
}
@@ -228,7 +217,6 @@
if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) {
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
cell.accessoryView = checkbox;
- [checkbox release];
self.lastIndexPath_lu = indexPath;
}
}
@@ -242,11 +230,11 @@
return cell;
}
--(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger) section {
+-(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section {
return IS_IPAD() ? 0 : 50;
}
--(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section {
if (IS_IPAD())
return nil;
UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
@@ -255,14 +243,14 @@
self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
[self.topControl addTarget:aTableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
[theView addSubview:self.topControl];
- return [theView autorelease];
+ return theView;
}
--(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger) section {
+-(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section {
return 40;
}
--(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger)section {
NSInteger height = 40;
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
footer.backgroundColor = [UIColor clearColor];
@@ -280,13 +268,12 @@
label.text = NSLocalizedString(@"Setting a Style might force a particular Scheme or Weapon configuration.",@"");
[footer addSubview:label];
- [label release];
- return [footer autorelease];
+ return footer;
}
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSIndexPath *lastIndexPath;
NSInteger index = self.topControl.selectedSegmentIndex;
if (index == 0)
@@ -304,7 +291,6 @@
UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
newCell.accessoryView = checkbox;
- [checkbox release];
UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:lastIndexPath];
oldCell.accessoryView = nil;
@@ -350,9 +336,7 @@
// some styles disable or force the choice of a particular scheme/weaponset
NSString *path = [[NSString alloc] initWithFormat:@"%@/%@.cfg",SCRIPTS_DIRECTORY(),[self.selectedScript stringByDeletingPathExtension]];
NSString *configFile = [[NSString alloc] initWithContentsOfFile:path];
- [path release];
NSArray *scriptOptions = [configFile componentsSeparatedByString:@"\n"];
- [configFile release];
self.scriptCommand = [NSString stringWithFormat:@"escript Scripts/Multiplayer/%@",self.selectedScript];
NSString *scheme = [scriptOptions objectAtIndex:0];
@@ -396,7 +380,7 @@
#pragma mark -
#pragma mark called by an NSNotification to empty or fill the sections completely
--(void) fillSections {
+- (void)fillSections {
if (self.sectionsHidden == YES) {
self.sectionsHidden = NO;
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
@@ -407,7 +391,7 @@
}
}
--(void) emptySections {
+- (void)emptySections {
if (self.sectionsHidden == NO) {
self.sectionsHidden = YES;
NSIndexSet *sections = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 1)];
@@ -426,13 +410,13 @@
UIViewAutoresizingFlexibleBottomMargin;
[self.view addSubview:theLabel];
- [theLabel release];
}
}
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.listOfSchemes = nil;
self.listOfWeapons = nil;
self.listOfScripts = nil;
@@ -440,37 +424,9 @@
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.listOfSchemes = nil;
- self.listOfWeapons = nil;
- self.listOfScripts = nil;
- self.lastIndexPath_sc = nil;
- self.lastIndexPath_we = nil;
- self.lastIndexPath_lu = nil;
- self.selectedScheme = nil;
- self.selectedWeapon = nil;
- self.selectedScript = nil;
- self.scriptCommand = nil;
- self.topControl = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc
+- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
- releaseAndNil(listOfSchemes);
- releaseAndNil(listOfWeapons);
- releaseAndNil(listOfScripts);
- releaseAndNil(lastIndexPath_sc);
- releaseAndNil(lastIndexPath_we);
- releaseAndNil(lastIndexPath_lu);
- releaseAndNil(selectedScheme);
- releaseAndNil(selectedWeapon);
- releaseAndNil(selectedScript);
- releaseAndNil(scriptCommand);
- releaseAndNil(topControl);
- [super dealloc];
}
--- a/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.h Sun Mar 11 20:43:15 2018 +0100
@@ -29,12 +29,12 @@
@property (assign) TCPsocket ssd;
@property (assign) NSInteger serverPort;
-@property (nonatomic,retain) NSString *serverAddress;
+@property (nonatomic, strong) NSString *serverAddress;
--(id) init;
--(id) init:(NSInteger) onPort withAddress:(NSString *)address;
--(id) initOnPort:(NSInteger) port;
--(id) initToAddress:(NSString *)address;
+- (id)init;
+- (id)init:(NSInteger)onPort withAddress:(NSString *)address;
+- (id)initOnPort:(NSInteger)port;
+- (id)initToAddress:(NSString *)address;
+(id) openServerConnection;
@end
--- a/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m Sun Mar 11 20:43:15 2018 +0100
@@ -29,7 +29,7 @@
#pragma mark -
#pragma mark init and class methods
--(id) init:(NSInteger) onPort withAddress:(NSString *)address {
+- (id)init:(NSInteger)onPort withAddress:(NSString *)address {
if ((self = [super init])) {
self.serverPort = onPort;
self.serverAddress = address;
@@ -38,22 +38,20 @@
return self;
}
--(id) init {
+- (id)init {
return [self init:NETGAME_DEFAULT_PORT withAddress:@"netserver.hedgewars.org"];
}
--(id) initOnPort:(NSInteger) port {
+- (id)initOnPort:(NSInteger)port {
return [self init:port withAddress:@"netserver.hedgewars.org"];
}
--(id) initToAddress:(NSString *)address {
+- (id)initToAddress:(NSString *)address {
return [self init:NETGAME_DEFAULT_PORT withAddress:address];
}
--(void) dealloc {
- releaseAndNil(serverAddress);
+- (void)dealloc {
serverConnection = nil;
- [super dealloc];
}
+(id) openServerConnection {
@@ -61,7 +59,7 @@
[NSThread detachNewThreadSelector:@selector(serverProtocol)
toTarget:connection
withObject:nil];
- [connection retain]; // retain count here is +2
+ // retain count here is +2
return connection;
}
@@ -70,18 +68,16 @@
-(int) sendToServer:(NSString *)command {
NSString *message = [[NSString alloc] initWithFormat:@"%@\n\n",command];
int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
- [message release];
return result;
}
-(int) sendToServer:(NSString *)command withArgument:(NSString *)argument {
NSString *message = [[NSString alloc] initWithFormat:@"%@\n%@\n\n",command,argument];
int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
- [message release];
return result;
}
--(void) serverProtocol {
+- (void)serverProtocol {
@autoreleasepool {
IPaddress ip;
@@ -143,7 +139,6 @@
NSString *bufferedMessage = [[NSString alloc] initWithBytes:buffer length:index-2 encoding:NSASCIIStringEncoding];
NSArray *listOfCommands = [bufferedMessage componentsSeparatedByString:@"\n"];
- [bufferedMessage release];
NSString *command = [listOfCommands objectAtIndex:0];
DLog(@"size = %d, %@", index-2, listOfCommands);
if ([command isEqualToString:@"PING"]) {
--- a/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -26,10 +26,10 @@
UITabBarController *tabController;
}
-@property (nonatomic, retain) UIViewController *targetController;
-@property (nonatomic, retain) NSArray *controllerNames;
-@property (nonatomic, retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) UIViewController *targetController;
+@property (nonatomic, strong) NSArray *controllerNames;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
--(void) dismissSplitView;
+- (void)dismissSplitView;
@end
--- a/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SettingsBaseViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -28,13 +28,13 @@
@implementation SettingsBaseViewController
@synthesize targetController, controllerNames, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
// the list of available controllers
NSArray *array = [[NSArray alloc] initWithObjects:NSLocalizedString(@"General",@""),
NSLocalizedString(@"Teams",@""),
@@ -43,7 +43,6 @@
NSLocalizedString(@"Support",@""),
nil];
self.controllerNames = array;
- [array release];
if (IS_IPAD())
{
@@ -57,7 +56,6 @@
[tableView reloadData];
[self.view addSubview:tableView];
[self tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
- [tableView release];
self.navigationItem.leftBarButtonItem = [self doneButton];
}
}
@@ -71,23 +69,24 @@
- (UIBarButtonItem *)doneButton
{
- return [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
+ return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
- action:@selector(dismissSplitView)] autorelease];
+ action:@selector(dismissSplitView)];
}
--(void) dismissSplitView {
+- (void)dismissSplitView {
[[AudioManagerController mainManager] playBackSound];
- [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissViewControllerAnimated:YES completion:nil];
+ UIViewController *vc = [[HedgewarsAppDelegate sharedAppDelegate] mainViewController];
+ [vc dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.controllerNames count];
}
@@ -97,7 +96,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSString *iconStr = nil;
switch ([indexPath row]) {
@@ -125,14 +124,13 @@
cell.textLabel.text = [controllerNames objectAtIndex:[indexPath row]];
UIImage *icon = [[UIImage alloc] initWithContentsOfFile:iconStr];
cell.imageView.image = icon;
- [icon release];
return cell;
}
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -168,7 +166,6 @@
nextController.navigationItem.hidesBackButton = YES;
[nextController viewWillAppear:NO];
[targetController.navigationController pushViewController:nextController animated:NO];
- [nextController release];
[[AudioManagerController mainManager] playClickSound];
}
@@ -177,28 +174,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning
+
+- (void)didReceiveMemoryWarning
{
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload
-{
- self.controllerNames = nil;
- self.lastIndexPath = nil;
- self.targetController = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc
-{
- releaseAndNil(targetController);
- releaseAndNil(controllerNames);
- releaseAndNil(lastIndexPath);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -29,52 +29,47 @@
@implementation SingleSchemeViewController
@synthesize schemeName, schemeDictionary, basicSettingList, gameModifierArray;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
// title, description, image name (+btn)
NSArray *mods = [[NSArray alloc] initWithContentsOfFile:GAMEMODS_FILE()];
self.gameModifierArray = mods;
- [mods release];
// title, image name (+icon), default value, max value, min value
NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:BASICFLAGS_FILE()];
self.basicSettingList = basicSettings;
- [basicSettings release];
self.title = NSLocalizedString(@"Edit scheme preferences",@"");
}
// load from file
--(void) viewWillAppear:(BOOL) animated {
+- (void)viewWillAppear:(BOOL) animated {
[super viewWillAppear:animated];
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
NSMutableDictionary *scheme = [[NSMutableDictionary alloc] initWithContentsOfFile:schemeFile];
- [schemeFile release];
self.schemeDictionary = scheme;
- [scheme release];
[self.tableView reloadData];
}
// save to file
--(void) viewWillDisappear:(BOOL) animated {
+- (void)viewWillDisappear:(BOOL) animated {
[super viewWillDisappear:animated];
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName];
[self.schemeDictionary writeToFile:schemeFile atomically:YES];
- [schemeFile release];
}
// force a redraw of the game mod section to reposition the slider
--(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (IS_IPAD() == NO)
return;
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
@@ -83,7 +78,7 @@
#pragma mark -
#pragma mark editableCellView delegate
// set the new value
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue {
if (tagValue == 0) {
// delete old file
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",SCHEMES_DIRECTORY(),self.schemeName] error:NULL];
@@ -98,11 +93,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
switch (section) {
case 0:
return 2;
@@ -128,11 +123,11 @@
NSInteger row = [indexPath row];
switch ([indexPath section]) {
- case 0:
+ case 0: {
editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (editableCell == nil) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifier0] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
+ reuseIdentifier:CellIdentifier0];
editableCell.delegate = self;
}
editableCell.tag = row;
@@ -151,31 +146,29 @@
}
cell = editableCell;
break;
- case 1:
+ }
+ case 1: {
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
NSDictionary *detail = [self.basicSettingList objectAtIndex:row];
// need to offset this section (see format in CommodityFunctions.m and above)
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
- reuseIdentifier:CellIdentifier1] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
+ reuseIdentifier:CellIdentifier1];
UISlider *slider = [[UISlider alloc] init];
[slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
[cell.contentView addSubview:slider];
- [slider release];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 7, 200, 30)];
label.tag = LABEL_TAG;
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
[cell.contentView addSubview:label];
- [label release];
}
UIImage *img = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/icon%@.png",ICONS_DIRECTORY(),
[[self.basicSettingList objectAtIndex:row] objectForKey:@"image"]]];
cell.imageView.image = img;
- [img release];
UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
NSString *basicSettingTitleKey = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"];
@@ -218,15 +211,15 @@
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
break;
- case 2:
+ }
+ case 2: {
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
- reuseIdentifier:CellIdentifier2] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier2];
UISwitch *onOff = [[UISwitch alloc] init];
[onOff addTarget:self action:@selector(toggleSwitch:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = onOff;
- [onOff release];
}
UISwitch *switcher = (UISwitch *)cell.accessoryView;
@@ -236,7 +229,6 @@
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/btn%@.png",ICONS_DIRECTORY(),
[[self.gameModifierArray objectAtIndex:row] objectForKey:@"image"]]];
cell.imageView.image = image;
- [image release];
cell.imageView.layer.cornerRadius = 6.0f;
cell.imageView.layer.masksToBounds = YES;
NSString *gameModTitleKey = [[self.gameModifierArray objectAtIndex:row] objectForKey:@"title"];
@@ -248,17 +240,18 @@
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
+ }
return cell;
}
--(void) toggleSwitch:(id) sender {
+- (void)toggleSwitch:(id)sender {
UISwitch *theSwitch = (UISwitch *)sender;
NSMutableArray *array = [self.schemeDictionary objectForKey:@"gamemod"];
[array replaceObjectAtIndex:theSwitch.tag-SWITCH_TAG withObject:[NSNumber numberWithBool:theSwitch.on]];
}
--(void) sliderChanged:(id) sender {
+- (void)sliderChanged:(id)sender {
// the slider that changed is sent as object
UISlider *theSlider = (UISlider *)sender;
// create the indexPath of the row of the slider
@@ -279,7 +272,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [aTableView cellForRowAtIndexPath:indexPath];
EditableCellView *editableCell = nil;
UISlider *cellSlider = nil;
@@ -373,27 +366,11 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
self.basicSettingList = nil;
self.gameModifierArray = nil;
}
--(void) viewDidUnload {
- self.schemeName = nil;
- self.schemeDictionary = nil;
- self.basicSettingList = nil;
- self.gameModifierArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(schemeName);
- releaseAndNil(schemeDictionary);
- releaseAndNil(basicSettingList);
- releaseAndNil(gameModifierArray);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/SingleTeamViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -36,7 +36,7 @@
@property (nonatomic,retain) NSArray *secondaryItems;
@property (nonatomic,retain) NSArray *moreSecondaryItems;
--(void) writeFile;
--(void) setWriteNeeded;
+- (void)writeFile;
+- (void)setWriteNeeded;
@end
--- a/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleTeamViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -32,14 +32,14 @@
@implementation SingleTeamViewController
@synthesize teamDictionary, normalHogSprite, secondaryItems, moreSecondaryItems, teamName;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark editableCellViewDelegate methods
// set the new value
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue {
if (TEAMNAME_TAG == tagValue) {
// delete old file
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName] error:NULL];
@@ -57,7 +57,7 @@
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
// labels for the entries
@@ -68,7 +68,6 @@
NSLocalizedString(@"Flag",@""),
NSLocalizedString(@"Level",@""),nil];
self.secondaryItems = array;
- [array release];
// labels for the subtitles
NSArray *moreArray = [[NSArray alloc] initWithObjects:
@@ -78,14 +77,11 @@
NSLocalizedString(@"Choose a charismatic symbol for your team",@""),
NSLocalizedString(@"Opt for controlling the team or let the AI lead",@""),nil];
self.moreSecondaryItems = moreArray;
- [moreArray release];
// load the base hog image, drawing will occure in cellForRow...
NSString *normalHogFile = [[NSString alloc] initWithFormat:@"%@/basehat-hedgehog.png",[[NSBundle mainBundle] resourcePath]];
UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:normalHogFile];
- [normalHogFile release];
self.normalHogSprite = hogSprite;
- [hogSprite release];
// listen if any childController modifies the plist and write it if needed
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setWriteNeeded) name:@"setWriteNeedTeams" object:nil];
@@ -94,7 +90,7 @@
self.title = NSLocalizedString(@"Edit team settings",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// load data about the team and write if there has been a change from other childControllers
@@ -104,14 +100,12 @@
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName];
NSMutableDictionary *teamDict = [[NSMutableDictionary alloc] initWithContentsOfFile:teamFile];
self.teamDictionary = teamDict;
- [teamDict release];
- [teamFile release];
[self.tableView reloadData];
}
// write on file if there has been a change
--(void) viewWillDisappear:(BOOL)animated {
+- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (isWriteNeeded)
@@ -120,14 +114,13 @@
#pragma mark -
// needed by other classes to warn about a user change
--(void) setWriteNeeded {
+- (void)setWriteNeeded {
isWriteNeeded = YES;
}
--(void) writeFile {
+- (void)writeFile {
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",TEAMS_DIRECTORY(),self.teamName];
[self.teamDictionary writeToFile:teamFile atomically:YES];
- [teamFile release];
//DLog(@"%@",teamDictionary);
isWriteNeeded = NO;
@@ -135,11 +128,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger rows = 0;
switch (section) {
case 0: // team name
@@ -189,11 +182,11 @@
UIImage *accessoryImage;
switch ([indexPath section]) {
- case 0:
+ case 0: {
editableCell = (EditableCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (editableCell == nil) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifier0] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
+ reuseIdentifier:CellIdentifier0];
editableCell.delegate = self;
editableCell.tag = TEAMNAME_TAG;
}
@@ -204,14 +197,15 @@
cell = editableCell;
break;
- case 1:
+ }
+ case 1: {
if ([indexPath row] == HW_getMaxNumberOfHogs())
{
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierDefault];
if (cell == nil)
{
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifierDefault] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
+ reuseIdentifier:CellIdentifierDefault];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
@@ -222,8 +216,8 @@
editableCell = (EditableCellView *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (editableCell == nil) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifier1] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
+ reuseIdentifier:CellIdentifier1];
editableCell.delegate = self;
}
editableCell.tag = [indexPath row];
@@ -233,20 +227,19 @@
// draw the hat on top of the hog
NSString *hatFile = [[NSString alloc] initWithFormat:@"%@/%@.png", HATS_DIRECTORY(), [[hogArray objectAtIndex:row] objectForKey:@"hat"]];
UIImage *hatSprite = [[UIImage alloc] initWithContentsOfFile: hatFile andCutAt:CGRectMake(0, 0, 32, 32)];
- [hatFile release];
editableCell.imageView.image = [self.normalHogSprite mergeWith:hatSprite atPoint:CGPointMake(0, 5)];
- [hatSprite release];
editableCell.textField.text = [[hogArray objectAtIndex:row] objectForKey:@"hogname"];
editableCell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
cell = editableCell;
break;
- case 2:
+ }
+ case 2: {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
- reuseIdentifier:CellIdentifier2] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
+ reuseIdentifier:CellIdentifier2];
}
cell.textLabel.text = [self.secondaryItems objectAtIndex:row];
@@ -258,25 +251,21 @@
GRAVES_DIRECTORY(),[teamDictionary objectForKey:@"grave"]]
andCutAt:CGRectMake(0,0,32,32)];
cell.imageView.image = accessoryImage;
- [accessoryImage release];
break;
case 1: // voice
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/HellishBomb.png",
GRAPHICS_DIRECTORY()]];
cell.imageView.image = accessoryImage;
- [accessoryImage release];
break;
case 2: // fort
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@-icon.png",
FORTS_DIRECTORY(),[teamDictionary objectForKey:@"fort"]]];
cell.imageView.image = accessoryImage;
- [accessoryImage release];
break;
case 3: // flags
accessoryImage = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png",
FLAGS_DIRECTORY(),[teamDictionary objectForKey:@"flag"]]];
cell.imageView.image = [accessoryImage scaleToSize:CGSizeMake(26, 18)];
- [accessoryImage release];
cell.imageView.layer.borderWidth = 1;
cell.imageView.layer.borderColor = [[UIColor blackColor] CGColor];
break;
@@ -287,13 +276,13 @@
objectAtIndex:0] objectForKey:@"level"]
intValue]]];
cell.imageView.image = accessoryImage;
- [accessoryImage release];
break;
default:
cell.imageView.image = nil;
break;
}
break;
+ }
}
return cell;
@@ -302,7 +291,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
NSInteger section = [indexPath section];
@@ -316,7 +305,6 @@
[gravesViewController setTeamDictionary:teamDictionary];
[self.navigationController pushViewController:gravesViewController animated:YES];
- [gravesViewController release];
break;
}
case 1: // voice
@@ -325,7 +313,6 @@
[voicesViewController setTeamDictionary:teamDictionary];
[self.navigationController pushViewController:voicesViewController animated:YES];
- [voicesViewController release];
break;
}
case 2: // fort
@@ -334,7 +321,6 @@
[fortsViewController setTeamDictionary:teamDictionary];
[self.navigationController pushViewController:fortsViewController animated:YES];
- [fortsViewController release];
break;
}
case 3: // flag
@@ -343,7 +329,6 @@
[flagsViewController setTeamDictionary:teamDictionary];
[self.navigationController pushViewController:flagsViewController animated:YES];
- [flagsViewController release];
break;
}
case 4: // level
@@ -352,7 +337,6 @@
[levelViewController setTeamDictionary:teamDictionary];
[self.navigationController pushViewController:levelViewController animated:YES];
- [levelViewController release];
break;
}
default:
@@ -373,7 +357,7 @@
}
// action to perform when you want to change a hog hat
--(void) tableView:(UITableView *)aTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
// if we are editing the field undo any change before proceeding
EditableCellView *cell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
[cell cancel:nil];
@@ -390,37 +374,15 @@
hogHatViewController.selectedHog = hogIndex;
[self.navigationController pushViewController:hogHatViewController animated:YES];
- [hogHatViewController release];
}
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
MSG_MEMCLEAN();
}
--(void) viewDidUnload {
- self.teamDictionary = nil;
- self.teamName = nil;
- self.normalHogSprite = nil;
- self.secondaryItems = nil;
- self.moreSecondaryItems = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- releaseAndNil(teamDictionary);
- releaseAndNil(teamName);
- releaseAndNil(normalHogSprite);
- releaseAndNil(secondaryItems);
- releaseAndNil(moreSecondaryItems);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -37,6 +37,6 @@
@property (nonatomic,retain) NSString *description;
@property (nonatomic,retain) UIImage *ammoStoreImage;
--(void) saveAmmos;
+- (void)saveAmmos;
@end
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -20,20 +20,20 @@
#import "SingleWeaponViewController.h"
@interface SingleWeaponViewController ()
-@property (nonatomic, retain) NSString *trPath;
-@property (nonatomic, retain) NSString *trFileName;
+@property (nonatomic, strong) NSString *trPath;
+@property (nonatomic, strong) NSString *trFileName;
@end
@implementation SingleWeaponViewController
@synthesize weaponName, description, ammoStoreImage;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
@@ -46,27 +46,24 @@
delay = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
crateness = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
- NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos.png",GRAPHICS_DIRECTORY()];
+ NSString *str = [NSString stringWithFormat:@"%@/AmmoMenu/Ammos_base.png", GRAPHICS_DIRECTORY()];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:str];
self.ammoStoreImage = img;
- [img release];
self.title = NSLocalizedString(@"Edit weapons preferences",@"");
}
--(void) viewWillAppear:(BOOL) animated {
+- (void)viewWillAppear:(BOOL) animated {
[super viewWillAppear:animated];
NSString *ammoFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",WEAPONS_DIRECTORY(),self.weaponName];
NSDictionary *weapon = [[NSDictionary alloc] initWithContentsOfFile:ammoFile];
- [ammoFile release];
self.description = [weapon objectForKey:@"description"];
const char *tmp1 = [[weapon objectForKey:@"ammostore_initialqt"] UTF8String];
const char *tmp2 = [[weapon objectForKey:@"ammostore_probability"] UTF8String];
const char *tmp3 = [[weapon objectForKey:@"ammostore_delay"] UTF8String];
const char *tmp4 = [[weapon objectForKey:@"ammostore_crate"] UTF8String];
- [weapon release];
// if the new weaponset is diffrent from the older we need to update it replacing
// the missing ammos with 0 quantity
@@ -87,12 +84,12 @@
[self.tableView reloadData];
}
--(void) viewWillDisappear:(BOOL) animated {
+- (void)viewWillDisappear:(BOOL) animated {
[super viewWillDisappear:animated];
[self saveAmmos];
}
--(void) saveAmmos {
+- (void)saveAmmos {
quantity[HW_getNumberOfWeapons()] = '\0';
probability[HW_getNumberOfWeapons()] = '\0';
delay[HW_getNumberOfWeapons()] = '\0';
@@ -113,17 +110,15 @@
NSString *ammoFile = [[NSString alloc] initWithFormat:@"%@/%@.plist",WEAPONS_DIRECTORY(),self.weaponName];
[weapon writeToFile:ammoFile atomically:YES];
- [ammoFile release];
- [weapon release];
}
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return 2;
else
@@ -140,8 +135,8 @@
if (0 == [indexPath section]) {
EditableCellView *editableCell = (EditableCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (editableCell == nil) {
- editableCell = [[[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifier0] autorelease];
+ editableCell = [[EditableCellView alloc] initWithStyle:UITableViewCellStyleDefault
+ reuseIdentifier:CellIdentifier0];
editableCell.delegate = self;
}
editableCell.tag = row;
@@ -162,7 +157,7 @@
} else {
WeaponCellView *weaponCell = (WeaponCellView *)[aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (weaponCell == nil) {
- weaponCell = [[[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
+ weaponCell = [[WeaponCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
weaponCell.delegate = self;
}
@@ -213,7 +208,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (0 == [indexPath section]) {
EditableCellView *editableCell = (EditableCellView *)[aTableView cellForRowAtIndexPath:indexPath];
[editableCell replyKeyboard];
@@ -223,7 +218,7 @@
#pragma mark -
#pragma mark editableCellView delegate
// set the new value
--(void) saveTextFieldValue:(NSString *)textString withTag:(NSInteger) tagValue {
+- (void)saveTextFieldValue:(NSString *)textString withTag:(NSInteger)tagValue {
if (tagValue == 0) {
// delete old file
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.plist",WEAPONS_DIRECTORY(),self.weaponName] error:NULL];
@@ -238,7 +233,7 @@
#pragma mark -
#pragma mark WeaponButtonControllerDelegate
--(void) updateValues:(NSArray *)withArray atIndex:(NSInteger) index {
+- (void)updateValues:(NSArray *)withArray atIndex:(NSInteger)index {
quantity[index] = [[NSString stringWithFormat:@"%d",[[withArray objectAtIndex:0] intValue]] characterAtIndex:0];
probability[index] = [[NSString stringWithFormat:@"%d",[[withArray objectAtIndex:1] intValue]] characterAtIndex:0];
delay[index] = [[NSString stringWithFormat:@"%d",[[withArray objectAtIndex:2] intValue]] characterAtIndex:0];
@@ -247,34 +242,13 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-}
--(void) viewDidUnload {
+- (void)dealloc {
free(quantity); quantity = NULL;
free(probability); probability = NULL;
free(delay); delay = NULL;
free(crateness); crateness = NULL;
- [super viewDidUnload];
- self.description = nil;
- self.weaponName = nil;
- self.ammoStoreImage = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
}
-
--(void) dealloc {
- releaseAndNil(_trPath);
- releaseAndNil(_trFileName);
-
- releaseAndNil(weaponName);
- releaseAndNil(description);
- releaseAndNil(ammoStoreImage);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/SquareButtonView.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SquareButtonView.h Sun Mar 11 20:43:15 2018 +0100
@@ -27,12 +27,12 @@
NSArray *colorArray;
}
-@property (nonatomic,retain) NSMutableDictionary *ownerDictionary;
-@property (nonatomic,retain) NSArray *colorArray;
-@property (nonatomic,assign) NSUInteger selectedColor;
-@property (nonatomic,assign) NSUInteger colorIndex;
+@property (nonatomic, strong) NSMutableDictionary *ownerDictionary;
+@property (nonatomic, strong) NSArray *colorArray;
+@property (assign) NSUInteger selectedColor;
+@property (assign) NSUInteger colorIndex;
--(void) nextColor;
--(void) selectColor:(NSUInteger) color;
+- (void)nextColor;
+- (void)selectColor:(NSUInteger) color;
@end
--- a/project_files/HedgewarsMobile/Classes/SquareButtonView.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SquareButtonView.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,7 +24,7 @@
@implementation SquareButtonView
@synthesize ownerDictionary, colorIndex, selectedColor, colorArray;
--(id) initWithFrame:(CGRect)frame {
+- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.colorIndex = 0;
self.selectedColor = 0;
@@ -46,7 +46,7 @@
return self;
}
--(void) nextColor {
+- (void)nextColor {
self.colorIndex++;
if (self.colorIndex >= [self.colorArray count])
@@ -58,7 +58,7 @@
[self selectColor:color];
}
--(void) selectColor:(NSUInteger) color {
+- (void)selectColor:(NSUInteger) color {
if (color != self.selectedColor) {
self.selectedColor = color;
self.colorIndex = [self.colorArray indexOfObject:[NSNumber numberWithUnsignedInteger:color]];
@@ -70,11 +70,6 @@
}
}
--(void) dealloc {
- releaseAndNil(ownerDictionary);
- releaseAndNil(colorArray);
- [super dealloc];
-}
@end
--- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
NSArray *statsArray;
}
-@property (nonatomic,retain) NSArray *statsArray;
+@property (nonatomic, strong) NSArray *statsArray;
@end
--- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,11 +23,11 @@
@implementation StatsPageViewController
@synthesize statsArray;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
--(void) viewDidLoad {
+- (void)viewDidLoad {
UITableView *aTableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
aTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
@@ -35,11 +35,9 @@
NSString *imgName = (IS_IPAD()) ? @"mediumBackground~ipad.png" : @"smallerBackground~iphone.png";
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgName];
UIImageView *background = [[UIImageView alloc] initWithImage:img];
- [img release];
background.frame = self.view.frame;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:background atIndex:0];
- [background release];
aTableView.separatorColor = [UIColor darkYellowColor];
aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
@@ -49,7 +47,6 @@
aTableView.rowHeight = 44;
[self.view addSubview:aTableView];
- [aTableView release];
[super viewDidLoad];
}
@@ -70,11 +67,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
--(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
if (section == 0)
return 1;
else if (section == 1)
@@ -92,7 +89,7 @@
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0];
if (section == 0) { // winning team
imgName = @"star";
@@ -117,12 +114,9 @@
NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",imgPath,imgName];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
- [imgString release];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
cell.imageView.image = img;
- [img release];
cell.accessoryView = imgView;
- [imgView release];
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.textLabel.adjustsFontSizeToFitWidth = YES;
@@ -143,13 +137,11 @@
UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"smallerTitle.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
- [img release];
imgView.center = CGPointMake(aTableView.frame.size.width/2, 160/2);
imgView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[header addSubview:imgView];
- [imgView release];
- return [header autorelease];
+ return header;
} else
return nil;
}
@@ -168,32 +160,27 @@
button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside];
[footer addSubview:button];
- [button release];
- return [footer autorelease];
+ return footer;
} else
return nil;
}
#pragma mark -
#pragma mark button delegate
--(void) dismissView {
+- (void)dismissView {
[[AudioManagerController mainManager] playClickSound];
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
self.statsArray = nil;
}
--(void) dealloc {
- releaseAndNil(statsArray);
- [super dealloc];
-}
@end
--- a/project_files/HedgewarsMobile/Classes/SupportViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SupportViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
NSArray *waysToSupport;
}
-@property (nonatomic, retain) NSArray *waysToSupport;
+@property (nonatomic, strong) NSArray *waysToSupport;
@end
--- a/project_files/HedgewarsMobile/Classes/SupportViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/SupportViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -23,13 +23,13 @@
@implementation SupportViewController
@synthesize waysToSupport;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
NSArray *array = [[NSArray alloc] initWithObjects:
@@ -40,7 +40,6 @@
NSLocalizedString(@"Chat with the devs in IRC",@""),
nil];
self.waysToSupport = array;
- [array release];
self.navigationItem.title = @"♥";
self.tableView.rowHeight = 50;
@@ -67,7 +66,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSString *rowString = [self.waysToSupport objectAtIndex:(row + section)];
cell.textLabel.text = rowString;
@@ -100,21 +99,18 @@
NSString *imgString = [[NSString alloc] initWithFormat:@"%@/%@.png",[[NSBundle mainBundle] resourcePath],imgName];
UIImage *img = [[UIImage alloc] initWithContentsOfFile:imgString];
- [imgString release];
cell.imageView.image = img;
if (section == 0) {
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
cell.accessoryView = imgView;
- [imgView release];
}
- [img release];
return cell;
}
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([indexPath section] == 0)
{
@@ -145,18 +141,16 @@
}
}
--(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
if (section == 1) {
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 240)];
footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UIImage *img = [[UIImage alloc] initWithContentsOfFile:@"surprise.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
- [img release];
imgView.center = CGPointMake(self.tableView.frame.size.width/2, 120);
imgView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[footer addSubview:imgView];
- [imgView release];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 20)];
label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
@@ -165,9 +159,8 @@
label.backgroundColor = [UIColor clearColor];
label.center = CGPointMake(self.tableView.frame.size.width/2, 250);
[footer addSubview:label];
- [label release];
- return [footer autorelease];
+ return footer;
} else
return nil;
}
@@ -179,19 +172,10 @@
#pragma mark -
#pragma mark Memory management
+
-(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
-}
-
--(void) viewDidUnload {
- self.waysToSupport = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc {
- releaseAndNil(waysToSupport);
- [super dealloc];
+ MSG_MEMCLEAN();
}
@end
--- a/project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m Sun Mar 11 20:43:15 2018 +0100
@@ -38,15 +38,16 @@
- (UIBarButtonItem *)doneButton
{
- return [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
+ return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
- action:@selector(dismissView)] autorelease];
+ action:@selector(dismissView)];
}
- (void)dismissView
{
[[AudioManagerController mainManager] playBackSound];
- [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissViewControllerAnimated:YES completion:nil];
+ UIViewController *vc = [[HedgewarsAppDelegate sharedAppDelegate] mainViewController];
+ [vc dismissViewControllerAnimated:YES completion:nil];
}
@end
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -32,11 +32,11 @@
NSArray *cachedContentsOfDir;
}
-@property (nonatomic,retain) UITableView *tableView;
-@property (nonatomic,assign) NSInteger selectedTeamsCount;
-@property (nonatomic,assign) NSInteger allTeamsCount;
-@property (nonatomic,retain) NSMutableArray *listOfAllTeams;
-@property (nonatomic,retain) NSMutableArray *listOfSelectedTeams;
-@property (nonatomic,retain) NSArray *cachedContentsOfDir;
+@property (nonatomic, strong) UITableView *tableView;
+@property (assign) NSInteger selectedTeamsCount;
+@property (assign) NSInteger allTeamsCount;
+@property (nonatomic, strong) NSMutableArray *listOfAllTeams;
+@property (nonatomic, strong) NSMutableArray *listOfSelectedTeams;
+@property (nonatomic, strong) NSArray *cachedContentsOfDir;
@end
--- a/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamConfigViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -25,13 +25,13 @@
@implementation TeamConfigViewController
@synthesize tableView, selectedTeamsCount, allTeamsCount, listOfAllTeams, listOfSelectedTeams, cachedContentsOfDir;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
UITableView *aTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
style:UITableViewStyleGrouped];
aTableView.delegate = self;
@@ -47,9 +47,7 @@
UIImageView *background = [[UIImageView alloc] initWithImage:backgroundImage];
background.contentMode = UIViewContentModeScaleAspectFill;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- [backgroundImage release];
[self.view addSubview:background];
- [background release];
[aTableView setBackgroundColorForAnyTable:[UIColor clearColor]];
}
@@ -58,13 +56,12 @@
aTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
aTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.tableView = aTableView;
- [aTableView release];
[self.view addSubview:self.tableView];
[super viewDidLoad];
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
if ([self.cachedContentsOfDir isEqualToArray:contentsOfDir] == NO) {
self.cachedContentsOfDir = contentsOfDir;
@@ -76,14 +73,11 @@
[NSNumber numberWithInt:4],@"number",
[colors objectAtIndex:i%[colors count]],@"color",nil];
[array addObject:dict];
- [dict release];
}
self.listOfAllTeams = array;
- [array release];
NSMutableArray *emptyArray = [[NSMutableArray alloc] initWithObjects:nil];
self.listOfSelectedTeams = emptyArray;
- [emptyArray release];
self.selectedTeamsCount = [self.listOfSelectedTeams count];
self.allTeamsCount = [self.listOfAllTeams count];
@@ -93,7 +87,7 @@
[super viewWillAppear:animated];
}
--(NSInteger) filterNumberOfHogs:(NSInteger) hogs {
+- (NSInteger)filterNumberOfHogs:(NSInteger)hogs {
NSInteger numberOfHogs;
if (hogs <= HW_getMaxNumberOfHogs() && hogs >= 1)
numberOfHogs = hogs;
@@ -108,11 +102,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return (section == 0 ? self.selectedTeamsCount : self.allTeamsCount);
}
@@ -126,11 +120,10 @@
if (section == 0) {
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier0];
if (cell == nil) {
- cell = [[[HoldTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0] autorelease];
+ cell = [[HoldTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier0];
SquareButtonView *squareButton = [[SquareButtonView alloc] initWithFrame:CGRectMake(0, 0, 36, 36)];
cell.accessoryView = squareButton;
- [squareButton release];
}
NSMutableDictionary *selectedRow = [listOfSelectedTeams objectAtIndex:[indexPath row]];
@@ -148,7 +141,7 @@
} else {
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell == nil)
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
cell.textLabel.text = [[[self.listOfAllTeams objectAtIndex:[indexPath row]] objectForKey:@"team"] stringByDeletingPathExtension];
cell.textLabel.backgroundColor = [UIColor clearColor];
@@ -158,12 +151,9 @@
if ([[firstHog objectForKey:@"level"] intValue] != 0) {
NSString *imgString = [[NSString alloc] initWithFormat:@"%@/robotBadge.png",[[NSBundle mainBundle] resourcePath]];
UIImage *sprite = [[UIImage alloc] initWithContentsOfFile:imgString];
- [imgString release];
UIImageView *spriteView = [[UIImageView alloc] initWithImage:sprite];
- [sprite release];
cell.accessoryView = spriteView;
- [spriteView release];
} else
cell.accessoryView = nil;
}
@@ -189,15 +179,14 @@
UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, 30)];
theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[theView addSubview:theLabel];
- [theLabel release];
- return [theView autorelease];
+ return theView;
}
-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return IS_IPAD() ? 40 : 30;
}
--(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section {
+-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger)section {
NSInteger height = IS_IPAD() ? 40 : 30;
UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
footer.backgroundColor = [UIColor clearColor];
@@ -218,14 +207,13 @@
label.text = NSLocalizedString(@"The robot badge indicates an AI-controlled team.",@"");
[footer addSubview:label];
- [label release];
- return [footer autorelease];
+ return footer;
}
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSUInteger section = [indexPath section];
@@ -255,7 +243,7 @@
}
}
--(void) holdAction:(NSString *)content onTable:(UITableView *)aTableView {
+- (void)holdAction:(NSString *)content onTable:(UITableView *)aTableView {
NSUInteger row;
for (row = 0; row < [self.listOfSelectedTeams count]; row++) {
NSDictionary *dict = [self.listOfSelectedTeams objectAtIndex:row];
@@ -276,30 +264,12 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
self.cachedContentsOfDir = nil;
MSG_MEMCLEAN();
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
- self.tableView = nil;
- self.listOfAllTeams = nil;
- self.listOfSelectedTeams = nil;
- self.cachedContentsOfDir = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
-
--(void) dealloc {
- releaseAndNil(tableView);
- releaseAndNil(listOfAllTeams);
- releaseAndNil(listOfSelectedTeams);
- releaseAndNil(cachedContentsOfDir);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
NSMutableArray *listOfTeams;
}
-@property (nonatomic, retain) NSMutableArray *listOfTeams;
+@property (nonatomic, strong) NSMutableArray *listOfTeams;
@end
--- a/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/TeamSettingsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,14 +24,14 @@
@implementation TeamSettingsViewController
@synthesize listOfTeams;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
// add an edit button
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"")
@@ -39,25 +39,23 @@
target:self
action:@selector(toggleEdit:)];
self.navigationItem.rightBarButtonItem = editButton;
- [editButton release];
self.navigationItem.title = NSLocalizedString(@"List of teams", nil);
}
// load the list of teams in the teams directory
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:TEAMS_DIRECTORY() error:NULL];
NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
self.listOfTeams = array;
- [array release];
[self.tableView reloadData];
}
// modifies the navigation bar to add the "Add" and "Done" buttons
--(void) toggleEdit:(id) sender {
+- (void)toggleEdit:(id)sender {
BOOL isEditing = self.tableView.editing;
[self.tableView setEditing:!isEditing animated:YES];
@@ -73,12 +71,11 @@
target:self
action:@selector(addTeam:)];
self.navigationItem.leftBarButtonItem = addButton;
- [addButton release];
}
}
// add a team file with default values and updates the table
--(void) addTeam:(id) sender {
+- (void)addTeam:(id)sender {
NSString *fileName = [[NSString alloc] initWithFormat:@"Default Team %u.plist", [self.listOfTeams count]];
[CreationChamber createTeamNamed:[fileName stringByDeletingPathExtension]];
@@ -91,16 +88,15 @@
NSInteger index = [self.listOfTeams indexOfObject:fileName];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
- [fileName release];
}
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.listOfTeams count];
}
@@ -110,7 +106,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSUInteger row = [indexPath row];
@@ -122,12 +118,11 @@
}
// delete the row and the file
--(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSString *teamFile = [[NSString alloc] initWithFormat:@"%@/%@",TEAMS_DIRECTORY(),[self.listOfTeams objectAtIndex:row]];
[[NSFileManager defaultManager] removeItemAtPath:teamFile error:NULL];
- [teamFile release];
[self.listOfTeams removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
@@ -136,7 +131,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SingleTeamViewController *singleTeamViewController = [[SingleTeamViewController alloc] initWithStyle:UITableViewStyleGrouped];
@@ -148,7 +143,6 @@
[singleTeamViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
[self.navigationController pushViewController:singleTeamViewController animated:YES];
- [singleTeamViewController release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@@ -156,26 +150,13 @@
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning
+
+- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Relinquish ownership any cached data, images, etc that aren't in use.
}
--(void) viewDidUnload
-{
- self.listOfTeams = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
-}
-
--(void) dealloc
-{
- releaseAndNil(listOfTeams);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.h Sun Mar 11 20:43:15 2018 +0100
@@ -22,17 +22,17 @@
@interface UIImage (extra)
-+(UIImage *)whiteImage:(CGSize) ofSize;
-+(UIImage *)drawHogsRepeated:(NSInteger) manyTimes;
-+(CGSize) imageSizeFromMetadataOf:(NSString *)aFileName;
++ (UIImage *)whiteImage:(CGSize)ofSize;
++ (UIImage *)drawHogsRepeated:(NSInteger)manyTimes;
++ (CGSize)imageSizeFromMetadataOf:(NSString *)aFileName;
--(UIImage *)scaleToSize:(CGSize) size;
--(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint;
--(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect;
--(UIImage *)cutAt:(CGRect) rect;
--(UIImage *)convertToGrayScale;
--(UIImage *)convertToNegative;
--(UIImage *)maskImageWith:(UIImage *)maskImage;
--(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh;
+- (UIImage *)scaleToSize:(CGSize)size;
+- (UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint)secondImagePoint;
+- (id)initWithContentsOfFile:(NSString *)path andCutAt:(CGRect)rect;
+- (UIImage *)cutAt:(CGRect)rect;
+- (UIImage *)convertToGrayScale;
+- (UIImage *)convertToNegative;
+- (UIImage *)maskImageWith:(UIImage *)maskImage;
+- (UIImage *)makeRoundCornersOfSize:(CGSize)sizewh;
@end
--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m Sun Mar 11 20:43:15 2018 +0100
@@ -22,7 +22,7 @@
@implementation UIImage (extra)
--(UIImage *)scaleToSize:(CGSize) size {
+- (UIImage *)scaleToSize:(CGSize)size {
// Create a bitmap graphics context; this will also set it as the current context
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, colorSpace, kCGImageAlphaPremultipliedFirst);
@@ -49,7 +49,7 @@
return resultImage;
}
--(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint {
+- (UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint)secondImagePoint {
if (secondImage == nil) {
DLog(@"Warning, secondImage == nil");
return self;
@@ -90,7 +90,7 @@
return resultImage;
}
--(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect {
+- (id)initWithContentsOfFile:(NSString *)path andCutAt:(CGRect)rect {
// load image from path
UIImage *image = [[UIImage alloc] initWithContentsOfFile: path];
@@ -99,7 +99,6 @@
CGImageRef cgImage = CGImageCreateWithImageInRect([image CGImage], rect);
// clean memory
- [image release];
// create a UIImage from the CGImage (memory must be allocated already)
UIImage *sprite = [self initWithCGImage:cgImage];
@@ -115,7 +114,7 @@
}
}
--(UIImage *)cutAt:(CGRect) rect {
+- (UIImage *)cutAt:(CGRect)rect {
CGImageRef cgImage = CGImageCreateWithImageInRect([self CGImage], rect);
UIImage *res = [UIImage imageWithCGImage:cgImage];
@@ -124,7 +123,7 @@
return res;
}
--(UIImage *)convertToGrayScale {
+- (UIImage *)convertToGrayScale {
// Create image rectangle with current image width/height
CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height);
@@ -197,7 +196,7 @@
CGContextRestoreGState(context);
}
--(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh {
+- (UIImage *)makeRoundCornersOfSize:(CGSize)sizewh {
CGFloat cornerWidth = sizewh.width;
CGFloat cornerHeight = sizewh.height;
CGFloat screenScale = [[UIScreen mainScreen] safeScale];
@@ -230,7 +229,7 @@
}
// by http://www.sixtemia.com/journal/2010/06/23/uiimage-negative-color-effect/
--(UIImage *)convertToNegative {
+- (UIImage *)convertToNegative {
UIGraphicsBeginImageContext(self.size);
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy);
[self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
@@ -243,7 +242,7 @@
return result;
}
-+(UIImage *)whiteImage:(CGSize) ofSize {
++ (UIImage *)whiteImage:(CGSize)ofSize {
CGFloat w = ofSize.width;
CGFloat h = ofSize.height;
DLog(@"w: %f, h: %f", w, h);
@@ -264,10 +263,9 @@
return bkgImg;
}
-+(UIImage *)drawHogsRepeated:(NSInteger) manyTimes {
++ (UIImage *)drawHogsRepeated:(NSInteger)manyTimes {
NSString *imgString = [[NSString alloc] initWithFormat:@"%@/hedgehog.png",[[NSBundle mainBundle] resourcePath]];
UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:imgString];
- [imgString release];
CGFloat screenScale = [[UIScreen mainScreen] safeScale];
int w = hogSprite.size.width * screenScale;
int h = hogSprite.size.height * screenScale;
@@ -277,7 +275,6 @@
// draw the two images in the current context
for (int i = 0; i < manyTimes; i++)
CGContextDrawImage(context, CGRectMake(i*8*screenScale, 0, w, h), [hogSprite CGImage]);
- [hogSprite release];
// Create bitmap image info from pixel data in current context
CGImageRef imageRef = CGBitmapContextCreateImage(context);
@@ -299,7 +296,7 @@
// this routine checks for the PNG size without loading it in memory
// https://github.com/steipete/PSFramework/blob/master/PSFramework%20Version%200.3/PhotoshopFramework/PSMetaDataFunctions.m
-+(CGSize) imageSizeFromMetadataOf:(NSString *)aFileName {
++ (CGSize)imageSizeFromMetadataOf:(NSString *)aFileName {
// File Name to C String.
const char *fileName = [aFileName UTF8String];
// source file
--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -31,8 +31,8 @@
int lastChannel;
}
-@property (nonatomic,retain) NSMutableDictionary *teamDictionary;
-@property (nonatomic,retain) NSArray *voiceArray;
-@property (nonatomic,retain) NSIndexPath *lastIndexPath;
+@property (nonatomic, strong) NSMutableDictionary *teamDictionary;
+@property (nonatomic, strong) NSArray *voiceArray;
+@property (nonatomic, strong) NSIndexPath *lastIndexPath;
@end
--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@synthesize teamDictionary, voiceArray, lastIndexPath;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
voiceBeingPlayed = NULL;
@@ -43,19 +43,19 @@
self.title = NSLocalizedString(@"Set hedgehog voices",@"");
}
--(void) viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// this moves the tableview to the top
[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
}
--(void) viewDidAppear:(BOOL)animated {
+- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
Mix_OpenAudio(44100, 0x8010, 1, 1024);
}
--(void) viewDidDisappear:(BOOL)animated {
+- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if(voiceBeingPlayed != NULL) {
Mix_HaltChannel(lastChannel);
@@ -68,11 +68,11 @@
#pragma mark -
#pragma mark Table view data source
--(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
--(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.voiceArray count];
}
@@ -83,7 +83,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSString *voice = [[voiceArray objectAtIndex:[indexPath row]] stringByDeletingPathExtension];
@@ -102,7 +102,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger newRow = [indexPath row];
NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
@@ -131,14 +131,14 @@
int index = arc4random_uniform((int)[array count]);
voiceBeingPlayed = Mix_LoadWAV([[voiceDir stringByAppendingString:[array objectAtIndex:index]] UTF8String]);
- [voiceDir release];
lastChannel = Mix_PlayChannel(-1, voiceBeingPlayed, 0);
}
#pragma mark -
#pragma mark Memory management
--(void) didReceiveMemoryWarning {
+
+- (void)didReceiveMemoryWarning {
if (voiceBeingPlayed != NULL) {
Mix_HaltChannel(lastChannel);
Mix_FreeChunk(voiceBeingPlayed);
@@ -149,26 +149,13 @@
[super didReceiveMemoryWarning];
}
--(void) viewDidUnload {
+- (void)dealloc {
if (voiceBeingPlayed != NULL) {
Mix_HaltChannel(lastChannel);
Mix_FreeChunk(voiceBeingPlayed);
voiceBeingPlayed = NULL;
}
- self.lastIndexPath = nil;
- self.teamDictionary = nil;
- self.voiceArray = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
}
--(void) dealloc {
- releaseAndNil(voiceArray);
- releaseAndNil(teamDictionary);
- releaseAndNil(lastIndexPath);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Classes/WeaponCellView.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.h Sun Mar 11 20:43:15 2018 +0100
@@ -22,12 +22,12 @@
@protocol WeaponButtonControllerDelegate <NSObject>
--(void) updateValues:(NSArray *)withArray atIndex:(NSInteger) index;
+- (void)updateValues:(NSArray *)withArray atIndex:(NSInteger)index;
@end
@interface WeaponCellView : UITableViewCell {
- id<WeaponButtonControllerDelegate> delegate;
+ id<WeaponButtonControllerDelegate> __weak delegate;
UILabel *weaponName;
UIImageView *weaponIcon;
@@ -50,26 +50,26 @@
UILabel *helpLabel;
}
-@property (nonatomic,assign) id<WeaponButtonControllerDelegate> delegate;
+@property (nonatomic, weak) id<WeaponButtonControllerDelegate> delegate;
-@property (nonatomic,retain) UILabel *weaponName;
-@property (nonatomic,retain) UIImageView *weaponIcon;
+@property (nonatomic, strong) UILabel *weaponName;
+@property (nonatomic, strong) UIImageView *weaponIcon;
-@property (nonatomic,retain) UISlider *initialSli;
-@property (nonatomic,retain) UISlider *probabilitySli;
-@property (nonatomic,retain) UISlider *delaySli;
-@property (nonatomic,retain) UISlider *crateSli;
+@property (nonatomic, strong) UISlider *initialSli;
+@property (nonatomic, strong) UISlider *probabilitySli;
+@property (nonatomic, strong) UISlider *delaySli;
+@property (nonatomic, strong) UISlider *crateSli;
-@property (nonatomic,retain) UIImageView *initialImg;
-@property (nonatomic,retain) UIImageView *probabilityImg;
-@property (nonatomic,retain) UIImageView *delayImg;
-@property (nonatomic,retain) UIImageView *crateImg;
+@property (nonatomic, strong) UIImageView *initialImg;
+@property (nonatomic, strong) UIImageView *probabilityImg;
+@property (nonatomic, strong) UIImageView *delayImg;
+@property (nonatomic, strong) UIImageView *crateImg;
-@property (nonatomic,retain) UILabel *initialLab;
-@property (nonatomic,retain) UILabel *probabilityLab;
-@property (nonatomic,retain) UILabel *delayLab;
-@property (nonatomic,retain) UILabel *crateLab;
+@property (nonatomic, strong) UILabel *initialLab;
+@property (nonatomic, strong) UILabel *probabilityLab;
+@property (nonatomic, strong) UILabel *delayLab;
+@property (nonatomic, strong) UILabel *crateLab;
-@property (nonatomic,retain) UILabel *helpLabel;
+@property (nonatomic, strong) UILabel *helpLabel;
@end
--- a/project_files/HedgewarsMobile/Classes/WeaponCellView.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/WeaponCellView.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,7 +24,7 @@
@synthesize delegate, weaponName, weaponIcon, initialSli, probabilitySli, delaySli, crateSli, helpLabel,
initialImg, probabilityImg, delayImg, crateImg, initialLab, probabilityLab, delayLab, crateLab;
--(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
delegate = nil;
@@ -67,16 +67,12 @@
NSString *imgAmmoStr = [[NSString alloc] initWithFormat:@"%@/ammopic.png",ICONS_DIRECTORY()];
initialImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgAmmoStr]];
- [imgAmmoStr release];
NSString *imgDamageStr = [[NSString alloc] initWithFormat:@"%@/iconDamage.png",ICONS_DIRECTORY()];
probabilityImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgDamageStr]];
- [imgDamageStr release];
NSString *imgTimeStr = [[NSString alloc] initWithFormat:@"%@/iconTime.png",ICONS_DIRECTORY()];
delayImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgTimeStr]];
- [imgTimeStr release];
NSString *imgBoxStr = [[NSString alloc] initWithFormat:@"%@/iconBox.png",ICONS_DIRECTORY()];
crateImg = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imgBoxStr]];
- [imgBoxStr release];
initialLab = [[UILabel alloc] init];
initialLab.backgroundColor = [UIColor clearColor];
@@ -128,7 +124,7 @@
return self;
}
--(void) layoutSubviews {
+- (void)layoutSubviews {
[super layoutSubviews];
CGFloat hOffset = 80;
@@ -186,13 +182,13 @@
}
/*
--(void) setSelected:(BOOL)selected animated:(BOOL)animated {
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
*/
--(void) valueChanged:(id) sender {
+- (void)valueChanged:(id)sender {
if (self.delegate != nil) {
initialLab.text = ((int)initialSli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)initialSli.value];
probabilityLab.text = ((int)probabilitySli.value == 9) ? @"∞" : [NSString stringWithFormat:@"%d",(int)probabilitySli.value];
@@ -209,7 +205,7 @@
DLog(@"error - delegate = nil!");
}
--(void) startDragging:(id) sender {
+- (void)startDragging:(id)sender {
UISlider *slider = (UISlider *)sender;
NSString *str = nil;
@@ -242,28 +238,8 @@
self.helpLabel.text = str;
}
--(void) stopDragging:(id) sender {
+- (void)stopDragging:(id)sender {
self.helpLabel.text = @"";
}
--(void) dealloc {
- self.delegate = nil;
- releaseAndNil(weaponName);
- releaseAndNil(weaponIcon);
- releaseAndNil(initialSli);
- releaseAndNil(probabilitySli);
- releaseAndNil(delaySli);
- releaseAndNil(crateSli);
- releaseAndNil(initialImg);
- releaseAndNil(probabilityImg);
- releaseAndNil(delayImg);
- releaseAndNil(crateImg);
- releaseAndNil(initialLab);
- releaseAndNil(probabilityLab);
- releaseAndNil(delayLab);
- releaseAndNil(crateLab);
- releaseAndNil(helpLabel);
- [super dealloc];
-}
-
@end
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.h Sun Mar 11 20:43:15 2018 +0100
@@ -24,6 +24,6 @@
NSMutableArray *listOfWeapons;
}
-@property (nonatomic, retain) NSMutableArray *listOfWeapons;
+@property (nonatomic, strong) NSMutableArray *listOfWeapons;
@end
--- a/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m Sun Mar 11 20:43:15 2018 +0100
@@ -24,13 +24,13 @@
@implementation WeaponSettingsViewController
@synthesize listOfWeapons;
--(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return rotationManager(interfaceOrientation);
}
#pragma mark -
#pragma mark View lifecycle
--(void) viewDidLoad {
+- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit",@"")
@@ -38,24 +38,22 @@
target:self
action:@selector(toggleEdit:)];
self.navigationItem.rightBarButtonItem = editButton;
- [editButton release];
self.navigationItem.title = NSLocalizedString(@"List of weapons", nil);
}
--(void) viewWillAppear:(BOOL) animated {
+- (void)viewWillAppear:(BOOL) animated {
[super viewWillAppear:animated];
NSArray *contentsOfDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:WEAPONS_DIRECTORY() error:NULL];
NSMutableArray *array = [[NSMutableArray alloc] initWithArray:contentsOfDir copyItems:YES];
self.listOfWeapons = array;
- [array release];
[self.tableView reloadData];
}
// modifies the navigation bar to add the "Add" and "Done" buttons
--(void) toggleEdit:(id) sender {
+- (void)toggleEdit:(id)sender {
BOOL isEditing = self.tableView.editing;
[self.tableView setEditing:!isEditing animated:YES];
@@ -71,11 +69,10 @@
target:self
action:@selector(addWeapon:)];
self.navigationItem.leftBarButtonItem = addButton;
- [addButton release];
}
}
--(void) addWeapon:(id) sender {
+- (void)addWeapon:(id)sender {
NSString *fileName = [[NSString alloc] initWithFormat:@"Weapon %u.plist", [self.listOfWeapons count]];
[CreationChamber createWeaponNamed:[fileName stringByDeletingPathExtension]];
@@ -88,7 +85,6 @@
NSInteger index = [self.listOfWeapons indexOfObject:fileName];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0] atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
- [fileName release];
}
#pragma mark -
@@ -106,7 +102,7 @@
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
- cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSUInteger row = [indexPath row];
@@ -118,12 +114,11 @@
}
// delete the row and the file
--(void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSString *schemeFile = [[NSString alloc] initWithFormat:@"%@/%@",WEAPONS_DIRECTORY(),[self.listOfWeapons objectAtIndex:row]];
[[NSFileManager defaultManager] removeItemAtPath:schemeFile error:NULL];
- [schemeFile release];
[self.listOfWeapons removeObjectAtIndex:row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
@@ -131,7 +126,7 @@
#pragma mark -
#pragma mark Table view delegate
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SingleWeaponViewController *singleWeaponViewController = [[SingleWeaponViewController alloc] initWithStyle:UITableViewStyleGrouped];
@@ -143,7 +138,6 @@
[singleWeaponViewController.tableView setContentOffset:CGPointMake(0,0) animated:NO];
[self.navigationController pushViewController:singleWeaponViewController animated:YES];
- [singleWeaponViewController release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@@ -151,25 +145,12 @@
#pragma mark -
#pragma mark Memory management
+
-(void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
-}
-
--(void) viewDidUnload
-{
- self.listOfWeapons = nil;
- MSG_DIDUNLOAD();
- [super viewDidUnload];
+ MSG_MEMCLEAN();
}
-
--(void) dealloc
-{
- releaseAndNil(listOfWeapons);
- [super dealloc];
-}
-
-
@end
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Wed Jan 17 00:59:39 2018 +0100
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Mar 11 20:43:15 2018 +0100
@@ -74,9 +74,9 @@
615AD9EB1207654E00F2FF04 /* helpButton.png in Resources */ = {isa = PBXBuildFile; fileRef = 615AD9EA1207654E00F2FF04 /* helpButton.png */; };
615BE3D4155C5DDF003CA34D /* uInputHandler.pas in Sources */ = {isa = PBXBuildFile; fileRef = 615BE3D3155C5DDF003CA34D /* uInputHandler.pas */; };
615E755A14E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E755914E41E8C00FBA131 /* MXAudioPlayerFadeOperation.m */; };
- 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
- 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
- 615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76BB14E4421200FBA131 /* MGSplitViewController.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
+ 615E76BC14E4421200FBA131 /* MGSplitCornersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B714E4421200FBA131 /* MGSplitCornersView.m */; };
+ 615E76BD14E4421200FBA131 /* MGSplitDividerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76B914E4421200FBA131 /* MGSplitDividerView.m */; };
+ 615E76BE14E4421200FBA131 /* MGSplitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 615E76BB14E4421200FBA131 /* MGSplitViewController.m */; };
615FEAE212A2A6640098EE92 /* localplayButton~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEADF12A2A6640098EE92 /* localplayButton~ipad.png */; };
615FEAE312A2A6640098EE92 /* localplayButton~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 615FEAE012A2A6640098EE92 /* localplayButton~iphone.png */; };
616065A8159A71FD00CFAEF4 /* hwclassic.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 616065A7159A71FD00CFAEF4 /* hwclassic.mp3 */; };
@@ -279,7 +279,7 @@
F65E1DC01B9B95A400A78ADF /* Icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = F65E1DBD1B9B95A400A78ADF /* Icon-76.png */; };
F65E1DC11B9B95A400A78ADF /* Icon-76@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F65E1DBE1B9B95A400A78ADF /* Icon-76@2x.png */; };
F6756D801BD8550500B6AB6B /* LabelWithIBLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = F6756D7F1BD8550500B6AB6B /* LabelWithIBLocalization.m */; };
- F67FC8121BEC06E700A9DC75 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = F67FC8101BEC06E700A9DC75 /* Appirater.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
+ F67FC8121BEC06E700A9DC75 /* Appirater.m in Sources */ = {isa = PBXBuildFile; fileRef = F67FC8101BEC06E700A9DC75 /* Appirater.m */; };
F67FC8141BEC072B00A9DC75 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F67FC8131BEC072B00A9DC75 /* StoreKit.framework */; };
F67FC8161BEC17AC00A9DC75 /* Appirater.bundle in Resources */ = {isa = PBXBuildFile; fileRef = F67FC8151BEC17AC00A9DC75 /* Appirater.bundle */; };
F6BA38461BA7A834005D16EA /* GameLogViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F6BA38451BA7A834005D16EA /* GameLogViewController.m */; };
@@ -429,6 +429,13 @@
remoteGlobalIDString = 928301160F10CAFC00CC5A3C;
remoteInfo = fpc;
};
+ EE3DE44D1FF6BF1100E2DF37 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 61A19AE314D2010A004B1E6D /* SDL.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = FAB598141BB5C1B100BE72C5;
+ remoteInfo = "libSDL-tv";
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -1152,6 +1159,7 @@
isa = PBXGroup;
children = (
61A19AEA14D2010A004B1E6D /* libSDL2.a */,
+ EE3DE44E1FF6BF1100E2DF37 /* libSDL2.a */,
);
name = Products;
sourceTree = "<group>";
@@ -1632,6 +1640,13 @@
remoteRef = 61A19C2214D20F51004B1E6D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
+ EE3DE44E1FF6BF1100E2DF37 /* libSDL2.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = libSDL2.a;
+ remoteRef = EE3DE44D1FF6BF1100E2DF37 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -2094,6 +2109,7 @@
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_DYNAMIC_NO_PIC = NO;
@@ -2111,6 +2127,7 @@
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
@@ -2203,6 +2220,7 @@
61022D7D12305A2800B08935 /* Distro AppStore */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
@@ -2322,6 +2340,7 @@
6137064C117B1CB3004EE44A /* Distro Adhoc */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;