- Increase limits on number of mines and explosives in game scheme
authorunc0rr
Tue, 06 May 2014 23:16:35 +0400
changeset 10236 8fa1ccfba752
parent 10235 bafca1686867
child 10237 282e49f9ce9d
- Increase limits on number of mines and explosives in game scheme - Stop trying to place mines/explosives after 4 fails to place in row
QTfrontend/model/ammoSchemeModel.cpp
QTfrontend/ui/page/pagescheme.cpp
hedgewars/uGears.pas
--- a/QTfrontend/model/ammoSchemeModel.cpp	Wed Apr 30 15:26:50 2014 +0400
+++ b/QTfrontend/model/ammoSchemeModel.cpp	Tue May 06 23:16:35 2014 +0400
@@ -309,7 +309,7 @@
             << QVariant(15)            // sudden death   29
             << QVariant(0)             // case prob      30
             << QVariant(0)             // mines time     31
-            << QVariant(80)            // mines number   32
+            << QVariant(200)           // mines number   32
             << QVariant(0)             // mine dud pct   33
             << QVariant(0)             // explosives     34
             << QVariant(35)            // health case pct 35
@@ -358,7 +358,7 @@
             << QVariant(0)             // mines time     31
             << QVariant(0)             // mines number   32
             << QVariant(0)             // mine dud pct   33
-            << QVariant(80)            // explosives     34
+            << QVariant(200)           // explosives     34
             << QVariant(35)            // health case pct 35
             << QVariant(25)            // health case amt 36
             << QVariant(47)            // water rise amt 37
--- a/QTfrontend/ui/page/pagescheme.cpp	Wed Apr 30 15:26:50 2014 +0400
+++ b/QTfrontend/ui/page/pagescheme.cpp	Tue May 06 23:16:35 2014 +0400
@@ -335,7 +335,7 @@
     l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon
     glBSLayout->addWidget(l,11,1,1,1);
     SB_Mines = new QSpinBox(gbBasicSettings);
-    SB_Mines->setRange(0, 80);
+    SB_Mines->setRange(0, 200);
     SB_Mines->setValue(0);
     SB_Mines->setSingleStep(5);
     glBSLayout->addWidget(SB_Mines,11,2,1,1);
@@ -363,9 +363,9 @@
     l->setPixmap(QPixmap(":/res/iconDamage.png"));
     glBSLayout->addWidget(l,13,1,1,1);
     SB_Explosives = new QSpinBox(gbBasicSettings);
-    SB_Explosives->setRange(0, 40);
+    SB_Explosives->setRange(0, 200);
     SB_Explosives->setValue(0);
-    SB_Explosives->setSingleStep(1);
+    SB_Explosives->setSingleStep(3);
     glBSLayout->addWidget(SB_Explosives,13,2,1,1);
 
     l = new QLabel(gbBasicSettings);
--- a/hedgewars/uGears.pas	Wed Apr 30 15:26:50 2014 +0400
+++ b/hedgewars/uGears.pas	Tue May 06 23:16:35 2014 +0400
@@ -564,27 +564,39 @@
 end;
 
 procedure AddMiscGears;
-var p,i,j,rx, ry: Longword;
+var p,i,j,rx, ry, unplaced: Longword;
     rdx, rdy: hwFloat;
     Gear: PGear;
 begin
 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000);
 
 i:= 0;
-Gear:= PGear(1);
-while (i < cLandMines) {and (Gear <> nil)} do // disable this check until better solution found
+unplaced:= 0;
+while (i < cLandMines) and (unplaced < 4) do
     begin
     Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
     FindPlace(Gear, false, 0, LAND_WIDTH);
+
+    if Gear = nil then 
+        inc(unplaced)
+    else
+        unplaced:= 0;
+
     inc(i)
     end;
 
 i:= 0;
-Gear:= PGear(1);
-while (i < cExplosives){ and (Gear <> nil)} do
+unplaced:= 0;
+while (i < cExplosives) and (unplaced < 4) do
     begin
     Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0);
     FindPlace(Gear, false, 0, LAND_WIDTH);
+
+    if Gear = nil then 
+        inc(unplaced)
+    else
+        unplaced:= 0;
+
     inc(i)
     end;