# HG changeset patch
# User koda
# Date 1289256394 -3600
# Node ID 7dcbd236ca594a46016a1938859f82d5a5cbf246
# Parent caa9b08990eba0ba6a313ac3034f752365f7acd5
this time i got it right, i'm sure of it; TEST ANYWAYS
diff -r caa9b08990eb -r 7dcbd236ca59 QTfrontend/gamecfgwidget.cpp
--- a/QTfrontend/gamecfgwidget.cpp Sun Nov 07 18:35:21 2010 -0500
+++ b/QTfrontend/gamecfgwidget.cpp Mon Nov 08 23:46:34 2010 +0100
@@ -158,7 +158,7 @@
sl.append(QString("e$gmflags %1").arg(getGameFlags()));
sl.append(QString("e$damagepct %1").arg(schemeData(22).toInt()));
sl.append(QString("e$turntime %1").arg(schemeData(23).toInt() * 1000));
- sl.append(QString("e$minestime %1").arg(schemeData(27).toInt() * 1000));
+ sl.append(QString("e$minestime %1").arg(schemeData(27).toInt()));
sl.append(QString("e$minesnum %1").arg(schemeData(28).toInt()));
sl.append(QString("e$sd_turns %1").arg(schemeData(25).toInt()));
sl.append(QString("e$casefreq %1").arg(schemeData(26).toInt()));
diff -r caa9b08990eb -r 7dcbd236ca59 hedgewars/uAI.pas
--- a/hedgewars/uAI.pas Sun Nov 07 18:35:21 2010 -0500
+++ b/hedgewars/uAI.pas Mon Nov 08 23:46:34 2010 +0100
@@ -333,7 +333,7 @@
with CurrentHedgehog^ do
if (Gear <> nil)
and ((Gear^.State and gstHHDriven) <> 0)
- and (TurnTimeLeft < cHedgehogTurnTime - 50) then
+ and (TurnTimeLeft + 50 > cHedgehogTurnTime ) then
if ((Gear^.State and gstHHThinking) = 0) then
if (BestActions.Pos >= BestActions.Count)
and (TurnTimeLeft > cStopThinkTime) then
diff -r caa9b08990eb -r 7dcbd236ca59 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Sun Nov 07 18:35:21 2010 -0500
+++ b/hedgewars/uGears.pas Mon Nov 08 23:46:34 2010 +0100
@@ -365,9 +365,9 @@
gear^.Elasticity:= _0_55;
gear^.Friction:= _0_995;
if cMinesTime < 0 then
- gear^.Timer:= getrandom(6)*1000
+ gear^.Timer:= getrandom(51)*100
else
- gear^.Timer:= cMinesTime*1;
+ gear^.Timer:= cMinesTime*1000;
end;
gtSMine: begin
gear^.Health:= 10;
diff -r caa9b08990eb -r 7dcbd236ca59 hedgewars/uMisc.pas
--- a/hedgewars/uMisc.pas Sun Nov 07 18:35:21 2010 -0500
+++ b/hedgewars/uMisc.pas Mon Nov 08 23:46:34 2010 +0100
@@ -758,7 +758,7 @@
cMapGen := 0; // MAPGEN_REGULAR
cMazeSize := 0;
cHedgehogTurnTime := 45000;
- cMinesTime := 3000;
+ cMinesTime := 3;
cMaxAIThinkTime := 9000;
cCloudsNumber := 9;
cHealthCaseProb := 35;
diff -r caa9b08990eb -r 7dcbd236ca59 hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas Sun Nov 07 18:35:21 2010 -0500
+++ b/hedgewars/uWorld.pas Mon Nov 08 23:46:34 2010 +0100
@@ -149,14 +149,14 @@
ScreenFadeSpeed:= 1;
// modified mine timers?
-if cMinesTime <> 3000 then
+if cMinesTime <> 3 then
begin
if cMinesTime = 0 then
g:= AddGoal(g, gfAny, gidNoMineTimer)
else if cMinesTime < 0 then
g:= AddGoal(g, gfAny, gidRandomMineTimer)
else
- g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime div 1000);
+ g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime);
end;
// if the string has been set, show it for (default timeframe) seconds
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Classes/CommodityFunctions.m
--- a/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/CommodityFunctions.m Mon Nov 08 23:46:34 2010 +0100
@@ -138,10 +138,12 @@
}
NSMutableArray *basicArray = [[NSMutableArray alloc] initWithObjects:
+ [NSNumber numberWithInt:100], //initialhealth
[NSNumber numberWithInt:100], //damagemodifier
[NSNumber numberWithInt:45], //turntime
- [NSNumber numberWithInt:100], //initialhealth
[NSNumber numberWithInt:15], //suddendeathtimeout
+ [NSNumber numberWithInt:47], //waterrise
+ [NSNumber numberWithInt:5], //healthdecrease
[NSNumber numberWithInt:5], //cratedrops
[NSNumber numberWithInt:35], //healthprob
[NSNumber numberWithInt:25], //healthamount
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Classes/EditableCellView.m
--- a/project_files/HedgewarsMobile/Classes/EditableCellView.m Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/EditableCellView.m Mon Nov 08 23:46:34 2010 +0100
@@ -31,7 +31,6 @@
textField = [[UITextField alloc] initWithFrame:CGRectZero];
textField.backgroundColor = [UIColor clearColor];
- textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
textField.delegate = self;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.clearsOnBeginEditing = NO;
@@ -77,6 +76,8 @@
skew +=2;
}
+ // sometimes the bold property gets lost
+ textField.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
textField.frame = CGRectMake(boundsX+offset+10, skew+10, 300, [UIFont labelFontSize] + 4);
}
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Classes/GameSetup.m
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m Mon Nov 08 23:46:34 2010 +0100
@@ -168,7 +168,6 @@
int i = 0;
int result = 0;
int mask = 0x00000004;
- int basicArraySize = [basicArray count] - 1;
// pack the gameflags in a single var and send it
for (NSNumber *value in gamemodArray) {
@@ -180,64 +179,34 @@
[self sendToEngine:flags];
[flags release];
- NSString *dmgMod = [[NSString alloc] initWithFormat:@"e$damagepct %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:dmgMod];
- [dmgMod release];
- if (i < basicArraySize) i++;
+ /* basic game flags */
+ NSString *path = [[NSString alloc] initWithFormat:@"%@/basicFlags_en.plist",IFRONTEND_DIRECTORY()];
+ NSArray *mods = [[NSArray alloc] initWithContentsOfFile:path];
+ [path release];
- // support for endless games
- NSInteger tentativeTurntime = [[basicArray objectAtIndex:i] intValue];
+ // initial health
+ result = [[basicArray objectAtIndex:0] intValue];
+
+ // turn time
+ NSInteger tentativeTurntime = [[basicArray objectAtIndex:1] intValue];
if (tentativeTurntime >= 100)
tentativeTurntime = 9999;
NSString *turnTime = [[NSString alloc] initWithFormat:@"e$turntime %d",tentativeTurntime * 1000];
[self sendToEngine:turnTime];
[turnTime release];
- if (i < basicArraySize) i++;
-
- result = [[basicArray objectAtIndex:i] intValue]; // initial health
- if (i < basicArraySize) i++;
-
- NSString *sdTime = [[NSString alloc] initWithFormat:@"e$sd_turns %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:sdTime];
- [sdTime release];
- if (i < basicArraySize) i++;
-
- NSString *crateDrops = [[NSString alloc] initWithFormat:@"e$casefreq %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:crateDrops];
- [crateDrops release];
- if (i < basicArraySize) i++;
-
- NSString *healthProb = [[NSString alloc] initWithFormat:@"e$healthprob %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:healthProb];
- [healthProb release];
- if (i < basicArraySize) i++;
- NSString *healthAmount = [[NSString alloc] initWithFormat:@"e$hcaseamount %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:healthAmount];
- [healthAmount release];
- if (i < basicArraySize) i++;
-
- NSString *minesTime = [[NSString alloc] initWithFormat:@"e$minestime %d",[[basicArray objectAtIndex:i] intValue] * 1000];
- [self sendToEngine:minesTime];
- [minesTime release];
- if (i < basicArraySize) i++;
+ for (i = 2; i < [basicArray count]; i++) {
+ NSDictionary *basicDict = [mods objectAtIndex:i];
+ NSString *command = [basicDict objectForKey:@"command"];
+ NSInteger value = [[basicArray objectAtIndex:i] intValue];
+ if ([basicDict objectForKey:@"checkOverMax"] && value >= [[basicDict objectForKey:@"max"] intValue])
+ value = 9999;
+ NSString *strToSend = [[NSString alloc] initWithFormat:@"%@ %d",command,value];
+ [self sendToEngine:strToSend];
+ [strToSend release];
+ }
+ [mods release];
- NSString *minesNumber = [[NSString alloc] initWithFormat:@"e$minesnum %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:minesNumber];
- [minesNumber release];
- if (i < basicArraySize) i++;
-
- NSString *dudMines = [[NSString alloc] initWithFormat:@"e$minedudpct %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:dudMines];
- [dudMines release];
- if (i < basicArraySize) i++;
-
- NSString *explosives = [[NSString alloc] initWithFormat:@"e$explosives %d",[[basicArray objectAtIndex:i] intValue]];
- [self sendToEngine:explosives];
- [explosives release];
- if (i < basicArraySize) i++;
-
- DLog(@"Sent %d flags and %d modes", [gamemodArray count], i);
[schemeDictionary release];
return result;
}
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m Mon Nov 08 23:46:34 2010 +0100
@@ -28,6 +28,21 @@
#define SLIDER_TAG 54321
#define SWITCH_TAG 67890
+#define checkValueString(detailString,labelSting,sliderRef); \
+ if ([labelSting isEqualToString:@"Turn Time"] && (NSInteger) sliderRef.value == 100) \
+ detailString = @"∞"; \
+ else if ([labelSting isEqualToString:@"Sudden Death Timeout"] && (NSInteger) sliderRef.value == 100) \
+ detailString = NSLocalizedString(@"Nvr",@"Short for 'Never'"); \
+ else if ([labelSting isEqualToString:@"Water Rise Amount"] && (NSInteger) sliderRef.value == 100) \
+ detailString = NSLocalizedString(@"Nvr",@"Short for 'Never'"); \
+ else if ([labelSting isEqualToString:@"Crate Drop Turns"] && (NSInteger) sliderRef.value == 0) \
+ detailString = NSLocalizedString(@"Nvr",@"Short for 'Never'"); \
+ else if ([labelSting isEqualToString:@"Mines Time"] && (NSInteger) sliderRef.value == -1) \
+ detailString = NSLocalizedString(@"Rnd",@"Short for 'Random'"); \
+ else \
+ detailString = [NSString stringWithFormat:@"%d",(NSInteger) sliderRef.value];
+
+
@implementation SingleSchemeViewController
@synthesize schemeName, schemeDictionary, basicSettingList, gameModifierArray;
@@ -161,8 +176,6 @@
offset = 50;
UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(offset+260, 12, offset+150, 23)];
- slider.maximumValue = [[detail objectForKey:@"max"] floatValue];
- slider.minimumValue = [[detail objectForKey:@"min"] floatValue];
[slider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
[cell.contentView addSubview:slider];
[slider release];
@@ -191,19 +204,14 @@
}
}
cellSlider.tag = SLIDER_TAG + row;
+ cellSlider.maximumValue = [[detail objectForKey:@"max"] floatValue];
+ cellSlider.minimumValue = [[detail objectForKey:@"min"] floatValue];
cellSlider.value = [[[self.schemeDictionary objectForKey:@"basic"] objectAtIndex:row] floatValue];
+ NSString *prestring = nil;
+ checkValueString(prestring,cellLabel.text,cellSlider);
+
// forced to use this weird format otherwise the label disappears when size of the text is bigger than the original
- NSString *prestring = [NSString stringWithFormat:@"%d",(NSInteger) cellSlider.value];
-
- // turntime 100 means unlimited time turns (set in GameSetup)
- if (row == 1 && (NSInteger) cellSlider.value == 100)
- prestring = @"∞";
- else
- // mines less than 0 means random
- if (row == 5 && (NSInteger) cellSlider.value == -1)
- prestring = NSLocalizedString(@"Rnd",@"Short for 'Random'");
-
while ([prestring length] <= 4)
prestring = [NSString stringWithFormat:@" %@",prestring];
cell.detailTextLabel.text = prestring;
@@ -254,16 +262,13 @@
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:theSlider.tag-SLIDER_TAG inSection:1];
// get its cell
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
- // grab the associated label
- UILabel *label = (UILabel *)cell.detailTextLabel;
+ // grab the associated labels
+ UILabel *detailLabel = (UILabel *)cell.detailTextLabel;
+ UILabel *cellLabel = (UILabel *)[cell.contentView viewWithTag:LABEL_TAG];
// modify it
- if ([indexPath row] == 1 && [indexPath section] == 1 && (NSInteger) theSlider.value == 100)
- label.text = @"∞";
- else
- if ([indexPath row] == 5 && [indexPath section] == 1 && (NSInteger) theSlider.value == -1)
- label.text = NSLocalizedString(@"Rnd",@"Short for 'Random'");
- else
- label.text = [NSString stringWithFormat:@"%d",(NSInteger) theSlider.value];
+
+ checkValueString(detailLabel.text,cellLabel.text,theSlider);
+
// save changes in the main array
NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"];
[array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]];
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj Mon Nov 08 23:46:34 2010 +0100
@@ -1482,7 +1482,7 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 1D6058900D05DD3D006BFB54 /* Hedgewars */ = {
+ 1D6058900D05DD3D006BFB54 /* Test Lua */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Hedgewars" */;
buildPhases = (
@@ -1573,7 +1573,7 @@
);
projectRoot = "";
targets = (
- 1D6058900D05DD3D006BFB54 /* Hedgewars */,
+ 1D6058900D05DD3D006BFB54 /* Test Lua */,
928301160F10CAFC00CC5A3C /* fpc */,
6179928B114AE0C800BA94A9 /* UpdateDataFolder */,
);
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Barrel Mayhem.plist Mon Nov 08 23:46:34 2010 +0100
@@ -5,9 +5,11 @@
basic
100
+ 100
30
- 100
15
+ 47
+ 5
0
35
25
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Default.plist Mon Nov 08 23:46:34 2010 +0100
@@ -5,9 +5,11 @@
basic
100
+ 100
45
- 100
15
+ 47
+ 5
5
35
25
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Minefield.plist Mon Nov 08 23:46:34 2010 +0100
@@ -4,10 +4,12 @@
basic
+ 50
150
30
- 50
15
+ 47
+ 5
0
35
25
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Pro Mode.plist Mon Nov 08 23:46:34 2010 +0100
@@ -5,9 +5,11 @@
basic
100
- 15
100
15
+ 15
+ 47
+ 5
0
35
25
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Shoppa.plist Mon Nov 08 23:46:34 2010 +0100
@@ -5,9 +5,11 @@
basic
100
+ 100
300
- 100
50
+ 47
+ 5
1
0
35
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Timeless.plist Mon Nov 08 23:46:34 2010 +0100
@@ -7,7 +7,9 @@
100
100
100
- 999
+ 100
+ 47
+ 5
5
35
30
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/Schemes/Tunnel Hogs.plist Mon Nov 08 23:46:34 2010 +0100
@@ -5,9 +5,11 @@
basic
100
+ 100
30
- 100
15
+ 47
+ 5
5
35
25
diff -r caa9b08990eb -r 7dcbd236ca59 project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist Sun Nov 07 18:35:21 2010 -0500
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist Mon Nov 08 23:46:34 2010 +0100
@@ -3,30 +3,10 @@
- default
- 100
- image
- Damage
- max
- 300
- min
- 10
- title
- Damage Modifier
-
-
- default
- 45
- image
- Time
- max
- 100
- min
- 1
- title
- Turn Time
-
-
+ checkOverMax
+
+ command
+
default
100
image
@@ -39,18 +19,90 @@
Initial Health
+ checkOverMax
+
+ command
+ e$damagepct
+ default
+ 100
+ image
+ Damage
+ max
+ 300
+ min
+ 10
+ title
+ Damage Modifier
+
+
+ checkOverMax
+
+ command
+ e$turntime
+ default
+ 45
+ image
+ Time
+ max
+ 100
+ min
+ 1
+ title
+ Turn Time
+
+
+ checkOverMax
+
+ command
+ e$sd_turns
default
15
image
SuddenDeath
max
- 999
+ 100
min
0
title
Sudden Death Timeout
+ checkOverMax
+
+ command
+ e$waterrise
+ default
+ 47
+ image
+ SuddenDeath
+ max
+ 100
+ min
+ 0
+ title
+ Water Rise Amount
+
+
+ checkOverMax
+
+ command
+ e$healthdec
+ default
+ 5
+ image
+ SuddenDeath
+ max
+ 100
+ min
+ 0
+ title
+ Health Decrease
+
+
+ checkOverMax
+
+ command
+ e$casefreq
default
5
image
@@ -60,9 +112,13 @@
min
0
title
- Crate Drops
+ Crate Drop Turns
+ checkOverMax
+
+ command
+ e$healthprob
default
35
image
@@ -75,6 +131,10 @@
Health Kit Probability
+ checkOverMax
+
+ command
+ e$hcaseamount
default
25
image
@@ -87,6 +147,10 @@
Health Amount in Kit
+ checkOverMax
+
+ command
+ e$minestime
default
3
image
@@ -99,6 +163,10 @@
Mines Time
+ checkOverMax
+
+ command
+ e$minesnum
default
4
image
@@ -111,6 +179,10 @@
Mines Number
+ checkOverMax
+
+ command
+ e$minedudpct
default
0
image
@@ -123,6 +195,10 @@
Dud Mines Probability
+ checkOverMax
+
+ command
+ e$explosives
default
2
image
diff -r caa9b08990eb -r 7dcbd236ca59 share/hedgewars/Data/Locale/en.txt
--- a/share/hedgewars/Data/Locale/en.txt Sun Nov 07 18:35:21 2010 -0500
+++ b/share/hedgewars/Data/Locale/en.txt Mon Nov 08 23:46:34 2010 +0100
@@ -499,7 +499,7 @@
05:11=Shared Ammo: All teams of the same color share their ammunition
05:12=Mine Timers: Mines will detonate after %1 second(s)
05:13=Mine Timers: Mines will detonate instantly
-05:14=Mine Timers: Mines will detonate after 0 - 3 seconds
+05:14=Mine Timers: Mines will detonate after 0 - 5 seconds
05:15=Damage Modifier: All weapons will do %1% damage
05:16=Health of all hogs is reset on end of turn
05:17=AI hogs respawn on death