disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines)
authorkoda
Fri, 29 Oct 2010 00:24:17 +0200
changeset 4003 ca0600ab38bf
parent 4001 cfd83b04e0be
child 4007 c76c895825ab
disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines) increase max mine timer to 5 seconds
QTfrontend/ammoSchemeModel.cpp
QTfrontend/gamecfgwidget.cpp
QTfrontend/pages.cpp
hedgewars/uConsole.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uMisc.pas
hedgewars/uScript.pas
hedgewars/uWorld.pas
project_files/HedgewarsMobile/Classes/GameSetup.m
project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m
project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist
--- a/QTfrontend/ammoSchemeModel.cpp	Wed Oct 27 01:33:38 2010 +0200
+++ b/QTfrontend/ammoSchemeModel.cpp	Fri Oct 29 00:24:17 2010 +0200
@@ -39,7 +39,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(false)         // shared ammo    15
-        << QVariant(false)         //disable girders 16
+        << QVariant(false)         // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -50,8 +50,8 @@
         << QVariant(100)           // init health    24
         << QVariant(15)            // sudden death   25
         << QVariant(5)             // case prob      26
-        << QVariant(3)             //  mines time    27
-        << QVariant(4)             //  landadds      28
+        << QVariant(3)             // mines time     27
+        << QVariant(4)             // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(2)             // explosives     30
         ;
@@ -101,7 +101,7 @@
         << "suddendeath"      // 25
         << "caseprobability"  // 26
         << "minestime"        // 27
-        << "landadds"         // 28
+        << "minesnum"         // 28
         << "minedudpct"       // 29
         << "explosives"       // 30
         ;
@@ -124,7 +124,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(false)         //disable girders 16
+        << QVariant(false)         // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -135,8 +135,8 @@
         << QVariant(100)           // init health    24
         << QVariant(15)            // sudden death   25
         << QVariant(0)             // case prob      26
-        << QVariant(3)             //  mines time    27
-        << QVariant(4)             //  landadds      28
+        << QVariant(3)             // mines time     27
+        << QVariant(4)             // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(2)             // explosives     30
         ;
@@ -159,7 +159,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(true)          //disable girders 16
+        << QVariant(true)          // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -170,8 +170,8 @@
         << QVariant(100)           // init health    24
         << QVariant(50)            // sudden death   25
         << QVariant(1)             // case prob      26
-        << QVariant(3)             //  mines time    27
-        << QVariant(4)             //  landadds      28
+        << QVariant(3)             // mines time     27
+        << QVariant(4)             // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(0)             // explosives     30
         ;
@@ -194,7 +194,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(true)          //disable girders 16
+        << QVariant(true)          // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -205,8 +205,8 @@
         << QVariant(100)           // init health    24
         << QVariant(15)            // sudden death   25
         << QVariant(0)             // case prob      26
-        << QVariant(3)             //  mines time    27
-        << QVariant(4)             //  landadds      28
+        << QVariant(3)             // mines time     27
+        << QVariant(4)             // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(0)             // explosives     30
         ;
@@ -229,7 +229,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(true)          //disable girders 16
+        << QVariant(true)          // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -240,8 +240,8 @@
         << QVariant(50)            // init health    24
         << QVariant(15)            // sudden death   25
         << QVariant(0)             // case prob      26
-        << QVariant(0)             //  mines time    27
-        << QVariant(80)            //  landadds      28
+        << QVariant(0)             // mines time     27
+        << QVariant(80)            // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(0)             // explosives     30
         ;
@@ -264,7 +264,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(false)         //disable girders 16
+        << QVariant(false)         // disable girders 16
         << QVariant(false)         // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -276,7 +276,7 @@
         << QVariant(15)            // sudden death   25
         << QVariant(0)             // case prob      26
         << QVariant(0)             // mines time     27
-        << QVariant(0)             // landadds       28
+        << QVariant(0)             // mines number   28
         << QVariant(0)             // mine dud pct   29
         << QVariant(80)            // explosives     30
         ;
@@ -299,7 +299,7 @@
         << QVariant(false)         // king           13
         << QVariant(false)         // place hog      14
         << QVariant(true)          // shared ammo    15
-        << QVariant(true)          //disable girders 16
+        << QVariant(true)          // disable girders 16
         << QVariant(true)          // disable land objects 17
         << QVariant(false)         // AI survival    18
         << QVariant(false)         // inf. attack    19
@@ -311,7 +311,7 @@
         << QVariant(15)            // sudden death   25
         << QVariant(5)             // case prob      26
         << QVariant(3)             // mines time     27
-        << QVariant(10)            // landadds       28
+        << QVariant(10)            // mines number   28
         << QVariant(10)            // mine dud pct   29
         << QVariant(10)            // explosives     30
         ;
--- a/QTfrontend/gamecfgwidget.cpp	Wed Oct 27 01:33:38 2010 +0200
+++ b/QTfrontend/gamecfgwidget.cpp	Fri Oct 29 00:24:17 2010 +0200
@@ -101,47 +101,47 @@
     quint32 result = 0;
 
     if (schemeData(1).toBool())
-        result |= 0x00001000;
+        result |= 0x00001000;       // fort
     if (schemeData(2).toBool())
-        result |= 0x00000010;
+        result |= 0x00000010;       // divide teams
     if (schemeData(3).toBool())
-        result |= 0x00000004;
+        result |= 0x00000004;       // solid land
     if (schemeData(4).toBool())
-        result |= 0x00000008;
+        result |= 0x00000008;       // border
     if (schemeData(5).toBool())
-        result |= 0x00000020;
+        result |= 0x00000020;       // low gravity
     if (schemeData(6).toBool())
-        result |= 0x00000040;
+        result |= 0x00000040;       // laser sight
     if (schemeData(7).toBool())
-        result |= 0x00000080;
+        result |= 0x00000080;       // invulnerable
     if (schemeData(8).toBool())
-        result |= 0x00000100;
+        result |= 0x00000100;       // mines
     if (schemeData(9).toBool())
-        result |= 0x00000200;
+        result |= 0x00000200;       // vampirism
     if (schemeData(10).toBool())
-        result |= 0x00000400;
+        result |= 0x00000400;       // karma
     if (schemeData(11).toBool())
-        result |= 0x00000800;
+        result |= 0x00000800;       // artillery
     if (schemeData(12).toBool())
-        result |= 0x00002000;
+        result |= 0x00002000;       // random
     if (schemeData(13).toBool())
-        result |= 0x00004000;
+        result |= 0x00004000;       // king
     if (schemeData(14).toBool())
-        result |= 0x00008000;
+        result |= 0x00008000;       // place hogs
     if (schemeData(15).toBool())
-        result |= 0x00010000;
+        result |= 0x00010000;       // shared ammo
     if (schemeData(16).toBool())
-        result |= 0x00020000;
+        result |= 0x00020000;       // disable girders
     if (schemeData(17).toBool())
-        result |= 0x00040000;
+        result |= 0x00040000;       // disable land obj
     if (schemeData(18).toBool())
-        result |= 0x00080000;
+        result |= 0x00080000;       // ai survival
     if (schemeData(19).toBool())
-        result |= 0x00100000;
+        result |= 0x00100000;       // infinite attacks
     if (schemeData(20).toBool())
-        result |= 0x00200000;
+        result |= 0x00200000;       // reset weaps
     if (schemeData(21).toBool())
-        result |= 0x00400000;
+        result |= 0x00400000;       // per hog ammo
 
     return result;
 }
@@ -159,7 +159,7 @@
     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$landadds %1").arg(schemeData(28).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()));
     sl.append(QString("e$minedudpct %1").arg(schemeData(29).toInt()));
--- a/QTfrontend/pages.cpp	Wed Oct 27 01:33:38 2010 +0200
+++ b/QTfrontend/pages.cpp	Fri Oct 29 00:24:17 2010 +0200
@@ -1645,7 +1645,7 @@
     l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon
     glBSLayout->addWidget(l,5,1,1,1);
     SB_MinesTime = new QSpinBox(gbBasicSettings);
-    SB_MinesTime->setRange(-1, 3);
+    SB_MinesTime->setRange(-1, 5);
     SB_MinesTime->setValue(3);
     SB_MinesTime->setSingleStep(1);
     SB_MinesTime->setSpecialValueText(tr("Random"));
--- a/hedgewars/uConsole.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uConsole.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -237,7 +237,7 @@
     RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
     RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
     RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
-    RegisterVariable('landadds', vtLongInt, @cLandAdditions , false);
+    RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
     RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
     RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
     RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
--- a/hedgewars/uConsts.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uConsts.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -338,7 +338,7 @@
     gfLowGravity         = $00000020;
     gfLaserSight         = $00000040;
     gfInvulnerable       = $00000080;
-    gfMines              = $00000100;           // redundant? same effect as 'landadds 0'
+
     gfVampiric           = $00000200;
     gfKarma              = $00000400;
     gfArtillery          = $00000800;
--- a/hedgewars/uGears.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uGears.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -1201,18 +1201,17 @@
 if ((GameFlags and gfForts) = 0) then
     begin
     // TODO: exclude each other or allow both, mines and explosives, on same map?
-    if ((GameFlags and gfMines) <> 0) then
-        for i:= 0 to Pred(cLandAdditions) do
-            begin
-            Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
-            FindPlace(Gear, false, 0, LAND_WIDTH);
-            end;
-//  No game flag for this for now
-        for i:= 0 to Pred(cExplosives) do
-            begin
-            Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0);
-            FindPlace(Gear, false, 0, LAND_WIDTH);
-            end;
+    for i:= 0 to Pred(cLandMines) do
+        begin
+        Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
+        FindPlace(Gear, false, 0, LAND_WIDTH);
+        end;
+    // No game flag for this for now
+    for i:= 0 to Pred(cExplosives) do
+        begin
+        Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0);
+        FindPlace(Gear, false, 0, LAND_WIDTH);
+        end;
     end;
 
 if (GameFlags and gfLowGravity) <> 0 then
--- a/hedgewars/uMisc.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uMisc.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -106,7 +106,7 @@
     cScreenSpace          : LongInt;
 
     cCaseFactor     : Longword;
-    cLandAdditions  : Longword;
+    cLandMines      : Longword;
     cExplosives     : Longword;
 
     cSeed           : shortstring;
@@ -752,7 +752,7 @@
     cDamagePercent      := 100;
     cMineDudPercent     := 0;
     cTemplateFilter     := 0;
-    cMapGen             := 0;//MAPGEN_REGULAR
+    cMapGen             := 0;   // MAPGEN_REGULAR
     cMazeSize           := 0;
     cHedgehogTurnTime   := 45000;
     cMinesTime          := 3000;
@@ -765,7 +765,7 @@
     RealTicks       := 0;
     AttackBar       := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
     cCaseFactor     := 5;  {0..9}
-    cLandAdditions  := 4;
+    cLandMines      := 4;
     cExplosives     := 2;
 
     GameState       := Low(TGameState);
--- a/hedgewars/uScript.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uScript.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -830,7 +830,7 @@
 ScriptSetString('Seed', cSeed);
 ScriptSetInteger('TurnTime', cHedgehogTurnTime);
 ScriptSetInteger('CaseFreq', cCaseFactor);
-ScriptSetInteger('LandAdds', cLandAdditions);
+ScriptSetInteger('MinesNum', cLandMines);
 ScriptSetInteger('Explosives', cExplosives);
 ScriptSetInteger('Delay', cInactDelay);
 ScriptSetInteger('Ready', cReadyDelay);
@@ -851,7 +851,7 @@
 ParseCommand('$gmflags ' + ScriptGetString('GameFlags'), true);
 ParseCommand('$turntime ' + ScriptGetString('TurnTime'), true);
 ParseCommand('$casefreq ' + ScriptGetString('CaseFreq'), true);
-ParseCommand('$landadds ' + ScriptGetString('LandAdds'), true);
+ParseCommand('$minesnum ' + ScriptGetString('MinesNum'), true);
 ParseCommand('$explosives ' + ScriptGetString('Explosives'), true);
 ParseCommand('$delay ' + ScriptGetString('Delay'), true);
 ParseCommand('$ready ' + ScriptGetString('Ready'), true);
@@ -1039,7 +1039,6 @@
 ScriptSetInteger('gfLowGravity', gfLowGravity);
 ScriptSetInteger('gfLaserSight', gfLaserSight);
 ScriptSetInteger('gfInvulnerable', gfInvulnerable);
-ScriptSetInteger('gfMines', gfMines);
 ScriptSetInteger('gfVampiric', gfVampiric);
 ScriptSetInteger('gfKarma', gfKarma);
 ScriptSetInteger('gfArtillery', gfArtillery);
--- a/hedgewars/uWorld.pas	Wed Oct 27 01:33:38 2010 +0200
+++ b/hedgewars/uWorld.pas	Fri Oct 29 00:24:17 2010 +0200
@@ -147,11 +147,11 @@
 if cMinesTime <> 3000 then
     begin
     if cMinesTime = 0 then
-        g:= AddGoal(g, gfMines, gidNoMineTimer)
+        g:= AddGoal(g, gfAny, gidNoMineTimer)
     else if cMinesTime < 0 then
-        g:= AddGoal(g, gfMines, gidRandomMineTimer)
+        g:= AddGoal(g, gfAny, gidRandomMineTimer)
     else
-        g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000);
+        g:= AddGoal(g, gfAny, gidMineTimer, cMinesTime div 1000);
     end;
 
 // if the string has been set, show it for (default timeframe) seconds
--- a/project_files/HedgewarsMobile/Classes/GameSetup.m	Wed Oct 27 01:33:38 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameSetup.m	Fri Oct 29 00:24:17 2010 +0200
@@ -205,7 +205,7 @@
     [self sendToEngine:minesTime];
     [minesTime release];
 
-    NSString *minesNumber = [[NSString alloc] initWithFormat:@"e$landadds %d",[[basicArray objectAtIndex:i++] intValue]];
+    NSString *minesNumber = [[NSString alloc] initWithFormat:@"e$minesnum %d",[[basicArray objectAtIndex:i++] intValue]];
     [self sendToEngine:minesNumber];
     [minesNumber release];
 
--- a/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m	Wed Oct 27 01:33:38 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleSchemeViewController.m	Fri Oct 29 00:24:17 2010 +0200
@@ -195,9 +195,14 @@
 
             // 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];
@@ -255,7 +260,10 @@
     if ([indexPath row] == 1 && [indexPath section] == 1 && (NSInteger) theSlider.value == 100)
         label.text = @"∞";
     else
-        label.text = [NSString stringWithFormat:@"%d",(NSInteger) theSlider.value];
+        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];
     // save changes in the main array
     NSMutableArray *array = [self.schemeDictionary objectForKey:@"basic"];
     [array replaceObjectAtIndex:theSlider.tag-SLIDER_TAG withObject:[NSNumber numberWithInt:(NSInteger) theSlider.value]];
--- a/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist	Wed Oct 27 01:33:38 2010 +0200
+++ b/project_files/HedgewarsMobile/Resources/Settings/iFrontend/basicFlags_en.plist	Fri Oct 29 00:24:17 2010 +0200
@@ -68,9 +68,9 @@
 		<key>image</key>
 		<string>Time</string>
 		<key>max</key>
-		<integer>3</integer>
+		<integer>5</integer>
 		<key>min</key>
-		<integer>0</integer>
+		<integer>-1</integer>
 		<key>title</key>
 		<string>Mines Time</string>
 	</dict>
@@ -82,7 +82,7 @@
 		<key>max</key>
 		<integer>80</integer>
 		<key>min</key>
-		<integer>1</integer>
+		<integer>0</integer>
 		<key>title</key>
 		<string>Mines Number</string>
 	</dict>