Flag for AI survival mode
authornemo
Fri, 20 Aug 2010 11:26:27 -0400
changeset 3743 234ce4da76d4
parent 3742 8461f0cef2e6
child 3744 543412536b7b
child 3745 23f2344c0dbe
Flag for AI survival mode
QTfrontend/ammoSchemeModel.cpp
QTfrontend/gamecfgwidget.cpp
QTfrontend/hedgewars.qrc
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/res/btnAISurvival.png
hedgewars/uConsts.pas
--- a/QTfrontend/ammoSchemeModel.cpp	Tue Aug 17 19:43:17 2010 -0400
+++ b/QTfrontend/ammoSchemeModel.cpp	Fri Aug 20 11:26:27 2010 -0400
@@ -41,15 +41,16 @@
         << QVariant(false)         // shared ammo    15
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(45)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(5)             // case prob      22
-        << QVariant(3)             //  mines time    23
-        << QVariant(4)             //  landadds      24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(2)             // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(45)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(5)             // case prob      23
+        << QVariant(3)             //  mines time    24
+        << QVariant(4)             //  landadds      25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(2)             // explosives     27
         ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -87,15 +88,16 @@
         << "sharedammo"       // 15
         << "disablegirders"   // 16
         << "disablelandobjects" // 17
-        << "damagefactor"     // 18
-        << "turntime"         // 19
-        << "health"           // 20
-        << "suddendeath"      // 21
-        << "caseprobability"  // 22
-        << "minestime"        // 23
-        << "landadds"         // 24
-        << "minedudpct"       // 25
-        << "explosives"       // 26
+        << "aisurvival"       // 18
+        << "damagefactor"     // 19
+        << "turntime"         // 20
+        << "health"           // 21
+        << "suddendeath"      // 22
+        << "caseprobability"  // 23
+        << "minestime"        // 24
+        << "landadds"         // 25
+        << "minedudpct"       // 26
+        << "explosives"       // 27
         ;
 
     QList<QVariant> proMode;
@@ -118,15 +120,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(15)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(0)             // case prob      22
-        << QVariant(3)             //  mines time    23
-        << QVariant(4)             //  landadds      24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(2)             // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(15)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(0)             // case prob      23
+        << QVariant(3)             //  mines time    24
+        << QVariant(4)             //  landadds      25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(2)             // explosives     27
         ;
 
     QList<QVariant> shoppa;
@@ -149,15 +152,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(30)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(50)            // sudden death   21
-        << QVariant(1)             // case prob      22
-        << QVariant(3)             //  mines time    23
-        << QVariant(4)             //  landadds      24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(0)             // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(30)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(50)            // sudden death   22
+        << QVariant(1)             // case prob      23
+        << QVariant(3)             //  mines time    24
+        << QVariant(4)             //  landadds      25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(0)             // explosives     27
         ;
 
     QList<QVariant> basketball;
@@ -180,15 +184,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(30)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(0)             // case prob      22
-        << QVariant(3)             //  mines time    23
-        << QVariant(4)             //  landadds      24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(0)             // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(30)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(0)             // case prob      23
+        << QVariant(3)             //  mines time    24
+        << QVariant(4)             //  landadds      25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(0)             // explosives     27
         ;
 
     QList<QVariant> minefield;
@@ -211,15 +216,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(150)           // damage modfier 18
-        << QVariant(30)            // turn time      19
-        << QVariant(50)            // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(0)             // case prob      22
-        << QVariant(0)             //  mines time    23
-        << QVariant(80)            //  landadds      24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(0)             // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(150)           // damage modfier 19
+        << QVariant(30)            // turn time      20
+        << QVariant(50)            // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(0)             // case prob      23
+        << QVariant(0)             //  mines time    24
+        << QVariant(80)            //  landadds      25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(0)             // explosives     27
         ;
 
     QList<QVariant> barrelmayhem;
@@ -242,15 +248,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(30)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(0)             // case prob      22
-        << QVariant(0)             // mines time     23
-        << QVariant(0)             // landadds       24
-        << QVariant(0)             // mine dud pct   25
-        << QVariant(80)            // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(30)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(0)             // case prob      23
+        << QVariant(0)             // mines time     24
+        << QVariant(0)             // landadds       25
+        << QVariant(0)             // mine dud pct   26
+        << QVariant(80)            // explosives     27
         ;
 
     QList<QVariant> tunnelhogs;
@@ -273,15 +280,16 @@
         << QVariant(true)          // shared ammo    15
         << QVariant(true)          //disable girders 16
         << QVariant(true)          // disable land objects 17
-        << QVariant(100)           // damage modfier 18
-        << QVariant(30)            // turn time      19
-        << QVariant(100)           // init health    20
-        << QVariant(15)            // sudden death   21
-        << QVariant(5)             // case prob      22
-        << QVariant(3)             // mines time     23
-        << QVariant(10)            // landadds       24
-        << QVariant(10)            // mine dud pct   25
-        << QVariant(10)            // explosives     26
+        << QVariant(false)         // AI survival    18
+        << QVariant(100)           // damage modfier 19
+        << QVariant(30)            // turn time      20
+        << QVariant(100)           // init health    21
+        << QVariant(15)            // sudden death   22
+        << QVariant(5)             // case prob      23
+        << QVariant(3)             // mines time     24
+        << QVariant(10)            // landadds       25
+        << QVariant(10)            // mine dud pct   26
+        << QVariant(10)            // explosives     27
         ;
 
     schemes.append(defaultScheme);
--- a/QTfrontend/gamecfgwidget.cpp	Tue Aug 17 19:43:17 2010 -0400
+++ b/QTfrontend/gamecfgwidget.cpp	Fri Aug 20 11:26:27 2010 -0400
@@ -53,7 +53,7 @@
     GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Game scheme"), GBoxOptions), 0, 0);
 
     QPixmap pmEdit(":/res/edit.png");
-
+    
     QPushButton * goToSchemePage = new QPushButton(GBoxOptions);
     goToSchemePage->setToolTip(tr("Edit schemes"));
     goToSchemePage->setIconSize(pmEdit.size());
@@ -134,13 +134,15 @@
         result |= 0x20000;
     if (schemeData(17).toBool())
         result |= 0x80000;
+    if (schemeData(18).toBool())
+        result |= 0x100000;
 
     return result;
 }
 
 quint32 GameCFGWidget::getInitHealth() const
 {
-    return schemeData(20).toInt();
+    return schemeData(21).toInt();
 }
 
 QStringList GameCFGWidget::getFullConfig() const
@@ -148,14 +150,14 @@
     QStringList sl;
     sl.append("eseed " + pMapContainer->getCurrentSeed());
     sl.append(QString("e$gmflags %1").arg(getGameFlags()));
-    sl.append(QString("e$damagepct %1").arg(schemeData(18).toInt()));
-    sl.append(QString("e$turntime %1").arg(schemeData(19).toInt() * 1000));
-    sl.append(QString("e$minestime %1").arg(schemeData(23).toInt() * 1000));
-    sl.append(QString("e$landadds %1").arg(schemeData(24).toInt()));
-    sl.append(QString("e$sd_turns %1").arg(schemeData(21).toInt()));
-    sl.append(QString("e$casefreq %1").arg(schemeData(22).toInt()));
-    sl.append(QString("e$minedudpct %1").arg(schemeData(25).toInt()));
-    sl.append(QString("e$explosives %1").arg(schemeData(26).toInt()));
+    sl.append(QString("e$damagepct %1").arg(schemeData(19).toInt()));
+    sl.append(QString("e$turntime %1").arg(schemeData(20).toInt() * 1000));
+    sl.append(QString("e$minestime %1").arg(schemeData(24).toInt() * 1000));
+    sl.append(QString("e$landadds %1").arg(schemeData(25).toInt()));
+    sl.append(QString("e$sd_turns %1").arg(schemeData(22).toInt()));
+    sl.append(QString("e$casefreq %1").arg(schemeData(23).toInt()));
+    sl.append(QString("e$minedudpct %1").arg(schemeData(26).toInt()));
+    sl.append(QString("e$explosives %1").arg(schemeData(27).toInt()));
     sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()));
     sl.append(QString("e$mapgen %1").arg(pMapContainer->get_mapgen()));
     sl.append(QString("e$maze_size %1").arg(pMapContainer->get_maze_size()));
--- a/QTfrontend/hedgewars.qrc	Tue Aug 17 19:43:17 2010 -0400
+++ b/QTfrontend/hedgewars.qrc	Fri Aug 20 11:26:27 2010 -0400
@@ -66,6 +66,7 @@
     <file>res/btnSharedAmmo.png</file>
     <file>res/btnDisableGirders.png</file>
     <file>res/btnDisableLandObjects.png</file>
+    <file>res/btnAISurvival.png</file>
     <file>res/iconBox.png</file>
     <file>res/iconHealth.png</file>
     <file>res/iconSuddenDeath.png</file>
--- a/QTfrontend/pages.cpp	Tue Aug 17 19:43:17 2010 -0400
+++ b/QTfrontend/pages.cpp	Fri Aug 20 11:26:27 2010 -0400
@@ -119,7 +119,7 @@
     Tips << tr("You should never install Hedgewars on computers you don't own (school, university, work, etc.). Please ask the responsible person instead!", "Tips");
     Tips << tr("Hedgewars can be perfect for short games during breaks. Just ensure you don't add too many hedgehogs or use an huge map. Reducing time and health might help as well.", "Tips");
     Tips << tr("No hedgehogs were harmed in making this game.", "Tips");
-
+    
 
     if(isDevBuild)
         mainNote->setText(QLabel::tr("This development build is 'work in progress' and may not be compatible with other versions of the game. Some features might be broken or incomplete. Use at your own risk!"));
@@ -369,7 +369,7 @@
     Mix_Chunk *sound;
     QDir tmpdir;
     mySdli->SDLMusicInit();
-
+    
     tmpdir.cd(datadir->absolutePath());
     tmpdir.cd("Sounds/voices");
     tmpdir.cd(CBVoicepack->currentText());
@@ -957,7 +957,7 @@
     CBSelect->addItems(tmpdir.entryList(QStringList("*.lua")).replaceInStrings(QRegExp("^(.*)\\.lua"), "\\1"));
 
     pageLayout->addWidget(CBSelect, 1, 1);
-
+    
     BtnStartTrain = new QPushButton(this);
     BtnStartTrain->setFont(*font14);
     BtnStartTrain->setText(QPushButton::tr("Go!"));
@@ -1073,7 +1073,7 @@
         QTableWidgetItem * item;
         item = new QTableWidgetItem(list[i + 1]); // room name
         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
-
+        
         // pick appropriate room icon and tooltip (game in progress yes/no; later maybe locked rooms etc.)
         if(list[i].compare("True"))
         {
@@ -1112,13 +1112,13 @@
         else
         {
             item = new QTableWidgetItem(list[i + 5]); // selected map
-
+            
             // check to see if we've got this map
             // not perfect but a start
             if(!mapList->contains(list[i + 5]))
                 item->setForeground(QBrush(QColor(255, 0, 0)));
         }
-
+        
         item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
         item->setToolTip(tr("Games may be played on precreated or randomized maps."));
         roomsList->setItem(r, 4, item);
@@ -1289,6 +1289,10 @@
     TBW_disablelandobjects->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Land Objects") + "</b>:<br />" + tr("Disable land objects when generating random maps."));
     glGMLayout->addWidget(TBW_disablelandobjects,4,0,1,1);
 
+    TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival.png");
+    TBW_aisurvival->setToolTip("<b>" + ToggleButtonWidget::tr("AI Survival Mode") + "</b>:<br />" + tr("AI respawns on death."));
+    glGMLayout->addWidget(TBW_aisurvival,4,1,1,1);
+
     // Right
     QLabel * l;
 
@@ -1472,15 +1476,16 @@
     mapper->addMapping(TBW_sharedammo, 15);
     mapper->addMapping(TBW_disablegirders, 16);
     mapper->addMapping(TBW_disablelandobjects, 17);
-    mapper->addMapping(SB_DamageModifier, 18);
-    mapper->addMapping(SB_TurnTime, 19);
-    mapper->addMapping(SB_InitHealth, 20);
-    mapper->addMapping(SB_SuddenDeath, 21);
-    mapper->addMapping(SB_CaseProb, 22);
-    mapper->addMapping(SB_MinesTime, 23);
-    mapper->addMapping(SB_Mines, 24);
-    mapper->addMapping(SB_MineDuds, 25);
-    mapper->addMapping(SB_Explosives, 26);
+    mapper->addMapping(TBW_aisurvival, 18);
+    mapper->addMapping(SB_DamageModifier, 19);
+    mapper->addMapping(SB_TurnTime, 20);
+    mapper->addMapping(SB_InitHealth, 21);
+    mapper->addMapping(SB_SuddenDeath, 22);
+    mapper->addMapping(SB_CaseProb, 23);
+    mapper->addMapping(SB_MinesTime, 24);
+    mapper->addMapping(SB_Mines, 25);
+    mapper->addMapping(SB_MineDuds, 26);
+    mapper->addMapping(SB_Explosives, 27);
 
     mapper->toFirst();
 }
@@ -1516,7 +1521,7 @@
     // 0
     pbAsk = addButton(tr("Fetch data"), pageLayout, 0, 0, 1, 3);
     connect(pbAsk, SIGNAL(clicked()), this, SIGNAL(askServerVars()));
-
+    
     // 1
     QLabel * lblSMN = new QLabel(this);
     lblSMN->setText(tr("Server message for latest version:"));
@@ -1550,10 +1555,10 @@
     pageLayout->addWidget(tb, 4, 1, 1, 2);
     connect(leServerMessageNew, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
     connect(leServerMessageOld, SIGNAL(textEdited(const QString &)), tb, SLOT(setHtml(const QString &)));
-
+    
     // 5
     pbClearAccountsCache = addButton(tr("Clear Accounts Cache"), pageLayout, 5, 0);
-
+    
     // 6
     pbSetSM = addButton(tr("Set data"), pageLayout, 6, 0, 1, 3);
 
--- a/QTfrontend/pages.h	Tue Aug 17 19:43:17 2010 -0400
+++ b/QTfrontend/pages.h	Fri Aug 20 11:26:27 2010 -0400
@@ -447,6 +447,7 @@
     ToggleButtonWidget * TBW_sharedammo;
     ToggleButtonWidget * TBW_disablegirders;
     ToggleButtonWidget * TBW_disablelandobjects;
+    ToggleButtonWidget * TBW_aisurvival;
 
     QSpinBox * SB_DamageModifier;
     QSpinBox * SB_TurnTime;
Binary file QTfrontend/res/btnAISurvival.png has changed
--- a/hedgewars/uConsts.pas	Tue Aug 17 19:43:17 2010 -0400
+++ b/hedgewars/uConsts.pas	Fri Aug 20 11:26:27 2010 -0400
@@ -330,27 +330,28 @@
     tfIgnoreDelays  = $00000008;
     tfTargetRespawn = $00000010;
 
-    gfAny            = $FFFFFFFF;
-    gfForts          = $00000001;
-    gfMultiWeapon    = $00000002;
-    gfSolidLand      = $00000004;
-    gfBorder         = $00000008;
-    gfDivideTeams    = $00000010;
-    gfLowGravity     = $00000020;
-    gfLaserSight     = $00000040;
-    gfInvulnerable   = $00000080;
-    gfMines          = $00000100;
-    gfVampiric       = $00000200;
-    gfKarma          = $00000400;
-    gfArtillery      = $00000800;
-    gfOneClanMode    = $00001000;
-    gfRandomOrder    = $00002000;
-    gfKing           = $00004000;
-    gfPlaceHog       = $00008000;
-    gfSharedAmmo     = $00010000;
-    gfDisableGirders = $00020000;
-    gfExplosives     = $00040000;
+    gfAny                = $FFFFFFFF;
+    gfForts              = $00000001;
+    gfMultiWeapon        = $00000002;
+    gfSolidLand          = $00000004;
+    gfBorder             = $00000008;
+    gfDivideTeams        = $00000010;
+    gfLowGravity         = $00000020;
+    gfLaserSight         = $00000040;
+    gfInvulnerable       = $00000080;
+    gfMines              = $00000100;
+    gfVampiric           = $00000200;
+    gfKarma              = $00000400;
+    gfArtillery          = $00000800;
+    gfOneClanMode        = $00001000;
+    gfRandomOrder        = $00002000;
+    gfKing               = $00004000;
+    gfPlaceHog           = $00008000;
+    gfSharedAmmo         = $00010000;
+    gfDisableGirders     = $00020000;
+    gfExplosives         = $00040000;
     gfDisableLandObjects = $00080000;
+    gfAISurvival         = $00100000;
     // NOTE: When adding new game flags, ask yourself
     // if a "game start notice" would be useful. If so,
     // add one in uWorld.pas - look for "AddGoal".