# HG changeset patch
# User koda
# Date 1303864478 -7200
# Node ID 102fef5ca5fc60f957beb743ee54ba4a67b2b2a1
# Parent a881cd3d3163d09bd0ef512906bf5ffe6fa23f5a
add getawaytime and tagteam mode to ios
some tweaks to scheme creation
diff -r a881cd3d3163 -r 102fef5ca5fc project_files/HedgewarsMobile/Classes/CreationChamber.m
--- a/project_files/HedgewarsMobile/Classes/CreationChamber.m Wed Apr 27 02:10:22 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/CreationChamber.m Wed Apr 27 02:34:38 2011 +0200
@@ -183,6 +183,7 @@
void createSchemeNamed (NSString *nameWithoutExt) {
NSString *schemesDirectory = SCHEMES_DIRECTORY();
+ NSString *path = nil;
if (![[NSFileManager defaultManager] fileExistsAtPath: schemesDirectory]) {
[[NSFileManager defaultManager] createDirectoryAtPath:schemesDirectory
@@ -191,53 +192,24 @@
error:NULL];
}
- int basicFlags[] = {100, 100, 45, 15, 47, 5, 100, 5, 35, 25, 3, 4, 0, 2};
- BOOL gameFlags[] = {NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, YES, NO, NO, NO, NO,
- NO, NO, NO, NO, NO, NO, NO};
-
- NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects:
- [NSNumber numberWithInt:basicFlags[0]], //initialhealth
- [NSNumber numberWithInt:basicFlags[1]], //damagemodifier
- [NSNumber numberWithInt:basicFlags[2]], //turntime
- [NSNumber numberWithInt:basicFlags[3]], //suddendeathtimeout
- [NSNumber numberWithInt:basicFlags[4]], //waterrise
- [NSNumber numberWithInt:basicFlags[5]], //healthdecrease
- [NSNumber numberWithInt:basicFlags[6]], //ropelength
- [NSNumber numberWithInt:basicFlags[7]], //cratedrops
- [NSNumber numberWithInt:basicFlags[8]], //healthprob
- [NSNumber numberWithInt:basicFlags[9]], //healthamount
- [NSNumber numberWithInt:basicFlags[10]], //minestime
- [NSNumber numberWithInt:basicFlags[11]], //minesnumber
- [NSNumber numberWithInt:basicFlags[12]], //dudmines
- [NSNumber numberWithInt:basicFlags[13]], //explosives
- nil];
+ // load data to get the size of the arrays and their default values
+ path = [NSString stringWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()];
+ NSArray *basicSettings = [[NSArray alloc] initWithContentsOfFile:path];
+ NSMutableArray *basicArray = [[NSMutableArray alloc] initWithCapacity:[basicSettings count]];
+ for (NSDictionary *basicDict in basicSettings)
+ [basicArray addObject:[basicDict objectForKey:@"default"]];
+ [basicSettings release];
- NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithObjects:
- [NSNumber numberWithBool:gameFlags[0]], //fortmode
- [NSNumber numberWithBool:gameFlags[1]], //divideteam
- [NSNumber numberWithBool:gameFlags[2]], //solidland
- [NSNumber numberWithBool:gameFlags[3]], //addborder
- [NSNumber numberWithBool:gameFlags[4]], //lowgravity
- [NSNumber numberWithBool:gameFlags[5]], //lasersight
- [NSNumber numberWithBool:gameFlags[6]], //invulnerable
- [NSNumber numberWithBool:gameFlags[7]], //resethealth
- [NSNumber numberWithBool:gameFlags[8]], //vampirism
- [NSNumber numberWithBool:gameFlags[9]], //karma
- [NSNumber numberWithBool:gameFlags[10]], //artillery
- [NSNumber numberWithBool:gameFlags[11]], //randomorder
- [NSNumber numberWithBool:gameFlags[12]], //king
- [NSNumber numberWithBool:gameFlags[13]], //placehedgehogs
- [NSNumber numberWithBool:gameFlags[14]], //clansharesammo
- [NSNumber numberWithBool:gameFlags[15]], //disablegirders
- [NSNumber numberWithBool:gameFlags[16]], //disablelandobjects
- [NSNumber numberWithBool:gameFlags[17]], //aisurvival
- [NSNumber numberWithBool:gameFlags[18]], //infattack
- [NSNumber numberWithBool:gameFlags[19]], //resetweaps
- [NSNumber numberWithBool:gameFlags[20]], //perhogammo
- [NSNumber numberWithBool:gameFlags[21]], //nowind
- [NSNumber numberWithBool:gameFlags[22]], //morewind
- nil];
-
+ path = [NSString stringWithFormat:@"%@/gameFlags_en.plist",IFRONTEND_DIRECTORY()];
+ NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
+ NSMutableArray *gamemodArray= [[NSMutableArray alloc] initWithCapacity:[mods count]];
+ for (int i = 0; i < [mods count]; i++)
+ [gamemodArray addObject:[NSNumber numberWithBool:NO]];
+ [mods release];
+
+ // workaround for randomorder that has to be set to YES
+ [gamemodArray replaceObjectAtIndex:11 withObject:[NSNumber numberWithBool:YES]];
+
NSMutableDictionary *theScheme = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
basicArray,@"basic",
gamemodArray,@"gamemod",
diff -r a881cd3d3163 -r 102fef5ca5fc project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Wed Apr 27 02:10:22 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m Wed Apr 27 02:34:38 2011 +0200
@@ -183,7 +183,7 @@
[self sendToEngine:flags];
[flags release];
- /* basic game flags */
+ // game modifiers
NSString *path = [[NSString alloc] initWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()];
NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
[path release];
diff -r a881cd3d3163 -r 102fef5ca5fc project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Wed Apr 27 02:10:22 2011 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Wed Apr 27 02:34:38 2011 +0200
@@ -193,6 +193,7 @@
UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
cellLabel.text = [[self.basicSettingList objectAtIndex:row] objectForKey:@"title"];
+ cellLabel.adjustsFontSizeToFitWidth = YES;
// can't use the viewWithTag method because row is dynamic
UISlider *cellSlider = nil;
diff -r a881cd3d3163 -r 102fef5ca5fc project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist Wed Apr 27 02:10:22 2011 +0200
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist Wed Apr 27 02:34:38 2011 +0200
@@ -120,7 +120,7 @@
min
25
title
- Rope Length
+ Rope Length (%)
checkOverMax
@@ -156,7 +156,7 @@
min
0
title
- Health Kit Probability
+ Health Kit Probability (%)
checkOverMax
@@ -228,7 +228,7 @@
min
0
title
- Dud Mines Probability
+ Dud Mines Probability (%)
checkOverMax
@@ -248,5 +248,23 @@
title
Explosives
+
+ checkOverMax
+
+ times1000
+
+ command
+ e$getawaytime
+ default
+ 100
+ image
+ Time
+ max
+ 999
+ min
+ 0
+ title
+ Get Away Time (%)
+
diff -r a881cd3d3163 -r 102fef5ca5fc project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Wed Apr 27 02:10:22 2011 +0200
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/gameFlags_en.plist Wed Apr 27 02:34:38 2011 +0200
@@ -186,5 +186,13 @@
title
More Wind
+
+ description
+ Clan teams take turns sharing their time
+ image
+ TagTeam
+ title
+ Tag Team
+