Add per-hog ammo option, initial stubs for infinite attack and weapon reset, fix a bug in ammo switching
authornemo
Sun, 10 Oct 2010 12:08:16 -0400
changeset 3943 9835060e5c01
parent 3942 7b44d8fb87e5
child 3944 7ec1ef6a5ee6
Add per-hog ammo option, initial stubs for infinite attack and weapon reset, fix a bug in ammo switching
QTfrontend/ammoSchemeModel.cpp
QTfrontend/game.cpp
QTfrontend/gamecfgwidget.cpp
QTfrontend/hedgewars.qrc
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/res/btnInfAttack.png
QTfrontend/res/btnPerHogAmmo.png
QTfrontend/res/btnResetWeps.png
hedgewars/CCHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uConsts.pas
--- a/QTfrontend/ammoSchemeModel.cpp	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/ammoSchemeModel.cpp	Sun Oct 10 12:08:16 2010 -0400
@@ -42,15 +42,18 @@
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(45)            // turn time      23
+        << 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(0)             // mine dud pct   29
+        << QVariant(2)             // explosives     30
         ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -89,15 +92,18 @@
         << "disablegirders"   // 16
         << "disablelandobjects" // 17
         << "aisurvival"       // 18
-        << "damagefactor"     // 19
-        << "turntime"         // 20
-        << "health"           // 21
-        << "suddendeath"      // 22
-        << "caseprobability"  // 23
-        << "minestime"        // 24
-        << "landadds"         // 25
-        << "minedudpct"       // 26
-        << "explosives"       // 27
+        << "infattack"        // 19
+        << "resetweps"        // 20
+        << "perhogammo"       // 21
+        << "damagefactor"     // 22
+        << "turntime"         // 23
+        << "health"           // 24
+        << "suddendeath"      // 25
+        << "caseprobability"  // 26
+        << "minestime"        // 27
+        << "landadds"         // 28
+        << "minedudpct"       // 29
+        << "explosives"       // 30
         ;
 
     QList<QVariant> proMode;
@@ -121,15 +127,18 @@
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(15)            // turn time      23
+        << 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(0)             // mine dud pct   29
+        << QVariant(2)             // explosives     30
         ;
 
     QList<QVariant> shoppa;
@@ -153,15 +162,18 @@
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(30)            // turn time      23
+        << 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(0)             // mine dud pct   29
+        << QVariant(0)             // explosives     30
         ;
 
     QList<QVariant> basketball;
@@ -185,15 +197,18 @@
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(30)            // turn time      23
+        << 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(0)             // mine dud pct   29
+        << QVariant(0)             // explosives     30
         ;
 
     QList<QVariant> minefield;
@@ -217,15 +232,18 @@
         << QVariant(true)          //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(150)           // damage modfier 22
+        << QVariant(30)            // turn time      23
+        << 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)             // mine dud pct   29
+        << QVariant(0)             // explosives     30
         ;
 
     QList<QVariant> barrelmayhem;
@@ -249,15 +267,18 @@
         << QVariant(false)         //disable girders 16
         << QVariant(false)         // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(30)            // turn time      23
+        << QVariant(100)           // init health    24
+        << QVariant(15)            // sudden death   25
+        << QVariant(0)             // case prob      26
+        << QVariant(0)             // mines time     27
+        << QVariant(0)             // landadds       28
+        << QVariant(0)             // mine dud pct   29
+        << QVariant(80)            // explosives     30
         ;
 
     QList<QVariant> tunnelhogs;
@@ -281,15 +302,18 @@
         << QVariant(true)          //disable girders 16
         << QVariant(true)          // disable land objects 17
         << 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
+        << QVariant(false)         // inf. attack    19
+        << QVariant(false)         // reset weps     20
+        << QVariant(false)         // per hog ammo   21
+        << QVariant(100)           // damage modfier 22
+        << QVariant(30)            // turn time      23
+        << QVariant(100)           // init health    24
+        << QVariant(15)            // sudden death   25
+        << QVariant(5)             // case prob      26
+        << QVariant(3)             // mines time     27
+        << QVariant(10)            // landadds       28
+        << QVariant(10)            // mine dud pct   29
+        << QVariant(10)            // explosives     30
         ;
 
     schemes.append(defaultScheme);
--- a/QTfrontend/game.cpp	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/game.cpp	Sun Oct 10 12:08:16 2010 -0400
@@ -84,13 +84,13 @@
         QList<HWTeam> teams = m_pTeamSelWidget->getPlayingTeams();
         for(QList<HWTeam>::iterator it = teams.begin(); it != teams.end(); ++it)
         {
-            HWProto::addStringListToBuffer(buf,
-                (*it).TeamGameConfig(gamecfg->getInitHealth()));
             HWProto::addStringToBuffer(buf, QString("eammloadt %1").arg(ammostr.mid(0, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammprob %1").arg(ammostr.mid(cAmmoNumber, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammdelay %1").arg(ammostr.mid(2 * cAmmoNumber, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammstore"));
+            HWProto::addStringListToBuffer(buf,
+                (*it).TeamGameConfig(gamecfg->getInitHealth()));
         }
     }
     RawSendIPC(buf);
--- a/QTfrontend/gamecfgwidget.cpp	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/gamecfgwidget.cpp	Sun Oct 10 12:08:16 2010 -0400
@@ -136,13 +136,19 @@
         result |= 0x80000;
     if (schemeData(18).toBool())
         result |= 0x100000;
+    if (schemeData(19).toBool())
+        result |= 0x200000;
+    if (schemeData(20).toBool())
+        result |= 0x400000;
+    if (schemeData(21).toBool())
+        result |= 0x800000;
 
     return result;
 }
 
 quint32 GameCFGWidget::getInitHealth() const
 {
-    return schemeData(21).toInt();
+    return schemeData(24).toInt();
 }
 
 QStringList GameCFGWidget::getFullConfig() const
@@ -150,14 +156,14 @@
     QStringList sl;
     sl.append("eseed " + pMapContainer->getCurrentSeed());
     sl.append(QString("e$gmflags %1").arg(getGameFlags()));
-    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$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$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()));
+    sl.append(QString("e$explosives %1").arg(schemeData(30).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	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/hedgewars.qrc	Sun Oct 10 12:08:16 2010 -0400
@@ -67,6 +67,9 @@
     <file>res/btnDisableGirders.png</file>
     <file>res/btnDisableLandObjects.png</file>
     <file>res/btnAISurvival.png</file>
+    <file>res/btnInfAttack.png</file>
+    <file>res/btnResetWeps.png</file>
+    <file>res/btnPerHogAmmo.png</file>
     <file>res/iconBox.png</file>
     <file>res/iconHealth.png</file>
     <file>res/iconSuddenDeath.png</file>
--- a/QTfrontend/pages.cpp	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/pages.cpp	Sun Oct 10 12:08:16 2010 -0400
@@ -1493,59 +1493,71 @@
 
     TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png");
     TBW_lowGravity->setToolTip("<b>" + ToggleButtonWidget::tr("Low Gravity") + "</b>:<br />" + tr("Lower gravity"));
-    glGMLayout->addWidget(TBW_lowGravity,1,0,1,1);
+    glGMLayout->addWidget(TBW_lowGravity,0,4,1,1);
 
     TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png");
     TBW_laserSight->setToolTip("<b>" + ToggleButtonWidget::tr("Laser Sight") + "</b>:<br />" + tr("Assisted aiming with laser sight"));
-    glGMLayout->addWidget(TBW_laserSight,1,1,1,1);
+    glGMLayout->addWidget(TBW_laserSight,1,0,1,1);
 
     TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png");
     TBW_invulnerable->setToolTip("<b>" + ToggleButtonWidget::tr("Invulnerable") + "</b>:<br />" + tr("All hogs have a personal forcefield"));
-    glGMLayout->addWidget(TBW_invulnerable,1,2,1,1);
+    glGMLayout->addWidget(TBW_invulnerable,1,1,1,1);
 
     TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png");
     TBW_mines->setToolTip("<b>" + ToggleButtonWidget::tr("Add Mines") + "</b>:<br />" + tr("Enable random mines"));
-    glGMLayout->addWidget(TBW_mines,1,3,1,1);
+    glGMLayout->addWidget(TBW_mines,1,2,1,1);
 
     TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png");
     TBW_vampiric->setToolTip("<b>" + ToggleButtonWidget::tr("Vampirism") + "</b>:<br />" + tr("Gain 80% of the damage you do back in health"));
-    glGMLayout->addWidget(TBW_vampiric,2,0,1,1);
+    glGMLayout->addWidget(TBW_vampiric,1,3,1,1);
 
     TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png");
     TBW_karma->setToolTip("<b>" + ToggleButtonWidget::tr("Karma") + "</b>:<br />" + tr("Share your opponents pain, share their damage"));
-    glGMLayout->addWidget(TBW_karma,2,1,1,1);
+    glGMLayout->addWidget(TBW_karma,1,4,1,1);
 
     TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png");
     TBW_artillery->setToolTip("<b>" + ToggleButtonWidget::tr("Artillery") + "</b>:<br />" + tr("Your hogs are unable to move, put your artillery skills to the test"));
-    glGMLayout->addWidget(TBW_artillery,2,2,1,1);
+    glGMLayout->addWidget(TBW_artillery,2,0,1,1);
 
     TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png");
     TBW_randomorder->setToolTip("<b>" + ToggleButtonWidget::tr("Random Order") + "</b>:<br />" + tr("Order of play is random instead of in room order."));
-    glGMLayout->addWidget(TBW_randomorder,2,3,1,1);
+    glGMLayout->addWidget(TBW_randomorder,2,1,1,1);
 
     TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png");
     TBW_king->setToolTip("<b>" + ToggleButtonWidget::tr("King") + "</b>:<br />" + tr("Play with a King. If he dies, your side dies."));
-    glGMLayout->addWidget(TBW_king,3,0,1,1);
+    glGMLayout->addWidget(TBW_king,2,2,1,1);
 
     TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png");
     TBW_placehog->setToolTip("<b>" + ToggleButtonWidget::tr("Place Hedgehogs") + "</b>:<br />" + tr("Take turns placing your hedgehogs before the start of play."));
-    glGMLayout->addWidget(TBW_placehog,3,1,1,1);
+    glGMLayout->addWidget(TBW_placehog,2,2,1,1);
 
     TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png");
     TBW_sharedammo->setToolTip("<b>" + ToggleButtonWidget::tr("Clan Shares Ammo") + "</b>:<br />" + tr("Ammo is shared between all teams that share a colour."));
-    glGMLayout->addWidget(TBW_sharedammo,3,2,1,1);
+    glGMLayout->addWidget(TBW_sharedammo,2,3,1,1);
 
     TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png");
     TBW_disablegirders->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Girders") + "</b>:<br />" + tr("Disable girders when generating random maps."));
-    glGMLayout->addWidget(TBW_disablegirders,3,3,1,1);
+    glGMLayout->addWidget(TBW_disablegirders,2,4,1,1);
 
     TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects.png");
     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);
+    glGMLayout->addWidget(TBW_disablelandobjects,3,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);
+    glGMLayout->addWidget(TBW_aisurvival,3,1,1,1);
+
+    TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack.png");
+    TBW_infattack->setToolTip("<b>" + ToggleButtonWidget::tr("Unlimited Attacks") + "</b>:<br />" + tr("Attacking does not end your turn."));
+    glGMLayout->addWidget(TBW_infattack,3,2,1,1);
+
+    TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps.png");
+    TBW_resetweps->setToolTip("<b>" + ToggleButtonWidget::tr("Reset Weapons") + "</b>:<br />" + tr("Weapons are reset to starting values each turn."));
+    glGMLayout->addWidget(TBW_resetweps,3,3,1,1);
+
+    TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo.png");
+    TBW_perhogammo->setToolTip("<b>" + ToggleButtonWidget::tr("Per Hedgehog Ammo") + "</b>:<br />" + tr("Each hedgehog has its own ammo. It does not share with the team."));
+    glGMLayout->addWidget(TBW_perhogammo,3,4,1,1);
 
     // Right
     QLabel * l;
--- a/QTfrontend/pages.h	Sun Oct 10 17:13:20 2010 +0200
+++ b/QTfrontend/pages.h	Sun Oct 10 12:08:16 2010 -0400
@@ -477,6 +477,9 @@
     ToggleButtonWidget * TBW_disablegirders;
     ToggleButtonWidget * TBW_disablelandobjects;
     ToggleButtonWidget * TBW_aisurvival;
+    ToggleButtonWidget * TBW_infattack;
+    ToggleButtonWidget * TBW_resetweps;
+    ToggleButtonWidget * TBW_perhogammo;
 
     QSpinBox * SB_DamageModifier;
     QSpinBox * SB_TurnTime;
Binary file QTfrontend/res/btnInfAttack.png has changed
Binary file QTfrontend/res/btnPerHogAmmo.png has changed
Binary file QTfrontend/res/btnResetWeps.png has changed
--- a/hedgewars/CCHandlers.inc	Sun Oct 10 17:13:20 2010 +0200
+++ b/hedgewars/CCHandlers.inc	Sun Oct 10 12:08:16 2010 -0400
@@ -162,6 +162,11 @@
     TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
     PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
     if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex
+    else if (GameFlags and gfPerHogAmmo) <> 0 then
+        begin
+        AddAmmoStore;
+        CurrentHedgehog^.AmmoStore:= StoreCnt - 1
+        end
     else CurrentHedgehog^.AmmoStore:= TeamsCount - 1;
     CurrentHedgehog^.Gear:= Gear;
     CurrentHedgehog^.Name:= id;
--- a/hedgewars/HHHandlers.inc	Sun Oct 10 17:13:20 2010 +0200
+++ b/hedgewars/HHHandlers.inc	Sun Oct 10 12:08:16 2010 -0400
@@ -42,7 +42,8 @@
 
 // Shouldn't more of this ammo switching stuff be moved to uAmmos ?
 procedure ChangeAmmo(Gear: PGear);
-var slot, ammoidx, i: Longword;
+var slot, i: Longword;
+    ammoidx: LongInt;
 begin
 slot:= Gear^.MsgParam;
 
@@ -73,7 +74,8 @@
             TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
             end;
         until (Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)
-        end else
+        end 
+    else
         begin
         i:= 0;
         // check whether there is ammo in slot
@@ -82,8 +84,9 @@
                or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i);
 
         if i <= cMaxSlotAmmoIndex then ammoidx:= i
+        else ammoidx:= -1
         end;
-        CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
+        if ammoidx >= 0 then CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
     end
 end;
 
--- a/hedgewars/uAmmos.pas	Sun Oct 10 17:13:20 2010 +0200
+++ b/hedgewars/uAmmos.pas	Sun Oct 10 12:08:16 2010 -0400
@@ -45,13 +45,13 @@
 function  GetAmmoEntry(var Hedgehog: THedgehog): PAmmo;
 
 var shoppa: boolean;
+    StoreCnt: Longword;
 
 implementation
 uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile;
 
 type TAmmoCounts = array[TAmmoType] of Longword;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
-    StoreCnt: Longword;
     ammoLoadout, ammoProbability, ammoDelay, ammoReinforcement: shortstring;
 
 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts);
--- a/hedgewars/uConsts.pas	Sun Oct 10 17:13:20 2010 +0200
+++ b/hedgewars/uConsts.pas	Sun Oct 10 12:08:16 2010 -0400
@@ -353,6 +353,9 @@
     gfExplosives         = $00040000;
     gfDisableLandObjects = $00080000;
     gfAISurvival         = $00100000;
+    gfInfAttack          = $00200000;
+    gfResetWeps          = $00400000;
+    gfPerHogAmmo         = $00800000;
     // 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".