Remove old Fort Mode from frontend
authorWuzzy <almikes@aol.com>
Tue, 15 Nov 2016 01:25:37 +0100
changeset 11886 34ede05e4d4f
parent 11885 2eac7a96b342
child 11887 bbd0cb0564c5
Remove old Fort Mode from frontend Part of ripping out Fort Mode from game schemes. This time for real. - Remove the game modifier button "Fort Mode" - Remove the scheme "Fort Mode" - Remove some fort mode handling code - Keep gfForts symbol to not mess up things too much - Old schemes are still supported, the fortsmode parameter is just ignored
QTfrontend/hedgewars.qrc
QTfrontend/model/ammoSchemeModel.cpp
QTfrontend/ui/page/pagescheme.cpp
QTfrontend/ui/page/pagescheme.h
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Locale/en.txt
share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
--- a/QTfrontend/hedgewars.qrc	Tue Nov 15 00:42:44 2016 +0100
+++ b/QTfrontend/hedgewars.qrc	Tue Nov 15 01:25:37 2016 +0100
@@ -101,7 +101,6 @@
         <file>res/PlaySound.png</file>
         <file>res/hh_small.png</file>
         <file>res/btnDisabled.png</file>
-        <file>res/btnForts@2x.png</file>
         <file>res/btnBorder@2x.png</file>
         <file>res/btnInvulnerable@2x.png</file>
         <file>res/btnLaserSight@2x.png</file>
--- a/QTfrontend/model/ammoSchemeModel.cpp	Tue Nov 15 00:42:44 2016 +0100
+++ b/QTfrontend/model/ammoSchemeModel.cpp	Tue Nov 15 01:25:37 2016 +0100
@@ -81,7 +81,6 @@
                          << "Minefield"
                          << "Barrel Mayhem"
                          << "Tunnel Hogs"
-                         << "Fort Mode"
                          << "Timeless"
                          << "Thinking with Portals"
                          << "King Mode"
@@ -425,57 +424,9 @@
             << QVariant()              // scriptparam    43
             ;
 
-    QList<QVariant> forts;
-    forts
-            << predefSchemesNames[7]   // name           0
-            << QVariant(true)          // fortsmode      1
-            << QVariant(true)          // team divide    2
-            << QVariant(false)         // solid land     3
-            << QVariant(false)         // border         4
-            << QVariant(false)         // low gravity    5
-            << QVariant(false)         // laser sight    6
-            << QVariant(false)         // invulnerable   7
-            << QVariant(false)         // reset health   8
-            << QVariant(false)         // vampiric       9
-            << QVariant(false)         // karma          10
-            << QVariant(false)         // artillery      11
-            << QVariant(true)          // random order   12
-            << QVariant(false)         // king           13
-            << QVariant(false)         // place hog      14
-            << QVariant(false)         // shared ammo    15
-            << QVariant(false)         // disable girders 16
-            << QVariant(false)         // disable land objects 17
-            << QVariant(false)         // AI survival    18
-            << QVariant(false)         // inf. attack    19
-            << QVariant(false)         // reset weps     20
-            << QVariant(false)         // per hog ammo   21
-            << QVariant(false)         // no wind        22
-            << QVariant(false)         // more wind      23
-            << QVariant(false)         // tag team       24
-            << QVariant(false)         // bottom border  25
-            << QVariant(100)           // damage modfier 26
-            << QVariant(45)            // turn time      27
-            << QVariant(100)           // init health    28
-            << QVariant(15)            // sudden death   29
-            << QVariant(5)             // case prob      30
-            << QVariant(3)             // mines time     31
-            << QVariant(0)             // mines number   32
-            << QVariant(0)             // mine dud pct   33
-            << QVariant(0)             // explosives     34
-            << QVariant(0)             // air mines      35
-            << QVariant(35)            // health case pct 36
-            << QVariant(25)            // health case amt 37
-            << QVariant(47)            // water rise amt 38
-            << QVariant(5)             // health dec amt 39
-            << QVariant(100)           // rope modfier   40
-            << QVariant(100)           // get away time  41
-            << QVariant(0)             // world edge     42
-            << QVariant()              // scriptparam    43
-            ;
-
     QList<QVariant> timeless;
     timeless
-            << predefSchemesNames[8]   // name           0
+            << predefSchemesNames[7]   // name           0
             << QVariant(false)         // fortsmode      1
             << QVariant(false)         // team divide    2
             << QVariant(false)         // solid land     3
@@ -523,7 +474,7 @@
 
     QList<QVariant> thinkingportals;
     thinkingportals
-            << predefSchemesNames[9]   // name           0
+            << predefSchemesNames[8]   // name           0
             << QVariant(false)         // fortsmode      1
             << QVariant(false)         // team divide    2
             << QVariant(false)         // solid land     3
@@ -571,7 +522,7 @@
 
     QList<QVariant> kingmode;
     kingmode
-            << predefSchemesNames[10]  // name           0
+            << predefSchemesNames[9]  // name           0
             << QVariant(false)         // fortsmode      1
             << QVariant(false)         // team divide    2
             << QVariant(false)         // solid land     3
@@ -619,7 +570,7 @@
 
 	QList<QVariant> construction;
     construction
-            << predefSchemesNames[11]  // name           0
+            << predefSchemesNames[10]  // name           0
             << QVariant(false)         // fortsmode      1
             << QVariant(false)         // team divide    2
             << QVariant(false)         // solid land     3
@@ -672,7 +623,6 @@
     schemes.append(minefield);
     schemes.append(barrelmayhem);
     schemes.append(tunnelhogs);
-    schemes.append(forts);
     schemes.append(timeless);
     schemes.append(thinkingportals);
     schemes.append(kingmode);
--- a/QTfrontend/ui/page/pagescheme.cpp	Tue Nov 15 00:42:44 2016 +0100
+++ b/QTfrontend/ui/page/pagescheme.cpp	Tue Nov 15 01:25:37 2016 +0100
@@ -68,25 +68,21 @@
     gbBasicSettings->setLayout(glBSLayout);
     // Left
 
-    TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts@2x.png");
-    TBW_mode_Forts->setWhatsThis(tr("Defend your fort and destroy the opponents, two team colours max!"));
-    glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1);
-
     TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders@2x.png");
     TBW_disablegirders->setWhatsThis(tr("Disable girders when generating random maps."));
-    glGMLayout->addWidget(TBW_disablegirders,0,1,1,1);
+    glGMLayout->addWidget(TBW_disablegirders,0,0,1,1);
 
     TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects@2x.png");
     TBW_disablelandobjects->setWhatsThis(tr("Disable land objects when generating random maps."));
-    glGMLayout->addWidget(TBW_disablelandobjects,0,2,1,1);
+    glGMLayout->addWidget(TBW_disablelandobjects,0,1,1,1);
 
     TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder@2x.png");
     TBW_border->setWhatsThis(tr("Add an indestructible border around the terrain"));
-    glGMLayout->addWidget(TBW_border,0,3,1,1);
+    glGMLayout->addWidget(TBW_border,0,2,1,1);
 
     TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/btnBottomBorder@2x.png");
     TBW_bottomborder->setWhatsThis(tr("Add an indestructible border along the bottom"));
-    glGMLayout->addWidget(TBW_bottomborder,0,4,1,1);
+    glGMLayout->addWidget(TBW_bottomborder,0,3,1,1);
 
     TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid@2x.png");
     TBW_solid->setWhatsThis(tr("Land can not be destroyed!"));
@@ -550,7 +546,6 @@
     selectScheme->setModel(model);
 
     mapper->addMapping(LE_name, 0);
-    mapper->addMapping(TBW_mode_Forts, 1);
     mapper->addMapping(TBW_teamsDivide, 2);
     mapper->addMapping(TBW_solid, 3);
     mapper->addMapping(TBW_border, 4);
--- a/QTfrontend/ui/page/pagescheme.h	Tue Nov 15 00:42:44 2016 +0100
+++ b/QTfrontend/ui/page/pagescheme.h	Tue Nov 15 01:25:37 2016 +0100
@@ -51,7 +51,6 @@
 
     private:
         QDataWidgetMapper * mapper;
-        ToggleButtonWidget * TBW_mode_Forts;
         ToggleButtonWidget * TBW_teamsDivide;
         ToggleButtonWidget * TBW_solid;
         ToggleButtonWidget * TBW_border;
--- a/hedgewars/uGears.pas	Tue Nov 15 00:42:44 2016 +0100
+++ b/hedgewars/uGears.pas	Tue Nov 15 01:25:37 2016 +0100
@@ -813,21 +813,15 @@
 var i, t, p, j: LongInt;
     ar: array[0..Pred(cMaxHHs)] of PHedgehog;
     Count: Longword;
-    divide, sectionDivide: boolean;
+    divide: boolean;
 begin
 if (GameFlags and gfPlaceHog) <> 0 then
     PlacingHogs:= true;
 
 divide:= ((GameFlags and gfDivideTeams) <> 0);
-sectionDivide:= divide and ((GameFlags and gfForts) <> 0);
-
-// TODO: there might be a smarter way to decide if dividing clans into equal-width map sections makes sense
-// e.g. by checking if there is enough spawn area in each section
-if divide and (not sectionDivide) then
-    sectionDivide:= (ClansCount = 2);
 
 // in section-divide mode, divide the map into equal-width sections and put each clan in one of them
-if sectionDivide then
+if divide then
     begin
     t:= leftX;
     for p:= 0 to (ClansCount - 1) do
@@ -912,7 +906,7 @@
 
 
 // divided teams: sort the hedgehogs from left to right by clan and shuffle clan members
-if divide and (not sectionDivide) then
+if divide then
     SortHHsByClan();
 end;
 
--- a/hedgewars/uLand.pas	Tue Nov 15 00:42:44 2016 +0100
+++ b/hedgewars/uLand.pas	Tue Nov 15 01:25:37 2016 +0100
@@ -630,36 +630,33 @@
     //if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then
     //    FillChar(Land,SizeOf(TCollisionArray),0);*)
 
-    if (GameFlags and gfForts) = 0 then
-        if cPathz[ptMapCurrent] <> '' then
-            begin
-            map:= cPathz[ptMapCurrent] + '/map.png';
-            mask:= cPathz[ptMapCurrent] + '/mask.png';
-            if (not(pfsExists(map)) and pfsExists(mask)) then
-                begin
-                maskOnly:= true;
-                LoadMask;
-                GenLandSurface
-                end
-            else LoadMap;
-            end
-        else
+    if cPathz[ptMapCurrent] <> '' then
+        begin
+        map:= cPathz[ptMapCurrent] + '/map.png';
+        mask:= cPathz[ptMapCurrent] + '/mask.png';
+        if (not(pfsExists(map)) and pfsExists(mask)) then
             begin
-            WriteLnToConsole('Generating land...');
-            case cMapGen of
-                mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]);
-                mgMaze  : begin ResizeLand(4096,2048); GenMaze; end;
-                mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end;
-                mgDrawn : GenDrawnMap;
-                mgForts : begin GameFlags:= (GameFlags or gfForts or gfDivideTeams); MakeFortsMap(); end;
-            else
-                OutError('Unknown mapgen', true);
-            end;
-            if cMapGen <> mgForts then
-                GenLandSurface
+            maskOnly:= true;
+            LoadMask;
+            GenLandSurface
             end
+        else LoadMap;
+        end
     else
-        MakeFortsMap;
+        begin
+        WriteLnToConsole('Generating land...');
+        case cMapGen of
+            mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]);
+            mgMaze  : begin ResizeLand(4096,2048); GenMaze; end;
+            mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end;
+            mgDrawn : GenDrawnMap;
+            mgForts : begin GameFlags:= (GameFlags or gfForts or gfDivideTeams); MakeFortsMap(); end;
+        else
+            OutError('Unknown mapgen', true);
+        end;
+        if cMapGen <> mgForts then
+            GenLandSurface
+        end;
 
     AddProgress;
 
--- a/hedgewars/uWorld.pas	Tue Nov 15 00:42:44 2016 +0100
+++ b/hedgewars/uWorld.pas	Tue Nov 15 01:25:37 2016 +0100
@@ -177,7 +177,6 @@
 g:= AddGoal(g, gfTagTeam, gidTagTeam); // tag team mode?
 
 // other important flags
-g:= AddGoal(g, gfForts, gidForts); // forts?
 g:= AddGoal(g, gfLowGravity, gidLowGravity); // low gravity?
 g:= AddGoal(g, gfInvulnerable, gidInvulnerable); // invulnerability?
 g:= AddGoal(g, gfVampiric, gidVampiric); // vampirism?
--- a/share/hedgewars/Data/Locale/en.txt	Tue Nov 15 00:42:44 2016 +0100
+++ b/share/hedgewars/Data/Locale/en.txt	Tue Nov 15 01:25:37 2016 +0100
@@ -525,7 +525,7 @@
 ; Game goal strings
 05:00=Game Modes
 05:01=The following rules apply
-05:02=Forts: Defend your fortress; vanquish your enemies!
+05:02=UNUSED
 05:03=Low Gravity: Watch your step
 05:04=Invulnerability: Hogs are (almost) invulnerable
 05:05=Vampirism: Hogs will be healed for 80% of the damage dealt
--- a/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Nov 15 00:42:44 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Nov 15 01:25:37 2016 +0100
@@ -444,7 +444,7 @@
 
 function onGameInit()
 
-	DisableGameFlags(gfKing, gfForts)
+	DisableGameFlags(gfKing)
 	EnableGameFlags(gfDivideTeams)
 
 	--SuddenDeathTurns = 999 -- suddendeath is off, effectively
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Tue Nov 15 00:42:44 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Tue Nov 15 01:25:37 2016 +0100
@@ -1542,7 +1542,7 @@
 
 	EnableGameFlags(gfInfAttack)
 
-	fortMode = (MapGen == mgForts) or GetGameFlag(gfForts)
+	fortMode = MapGen == mgForts
 
 	-- if there are forts, let engine place the hogs on them
 	if fortMode then
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Tue Nov 15 00:42:44 2016 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Tue Nov 15 01:25:37 2016 +0100
@@ -704,7 +704,6 @@
 					}
 
 local gameFlagList =	{
-			{"gfForts", false, gfForts},
 			{"gfMultiWeapon", false, gfMultiWeapon},
 			{"gfBorder", false, gfBorder},
 			{"gfSolidLand", false, gfSolidLand},