merge
authorkoda
Sat, 18 Dec 2010 15:14:27 +0100
changeset 4552 e96d3773c375
parent 4549 2e0447837a97 (current diff)
parent 4551 05c32ee166b6 (diff)
child 4553 442bac2e6ca6
merge
share/hedgewars/Data/Scripts/Multiplayer/RandomWeapon.cfg
share/hedgewars/Data/Scripts/Multiplayer/RandomWeapon.lua
--- a/QTfrontend/gamecfgwidget.cpp	Sat Dec 18 15:14:16 2010 +0100
+++ b/QTfrontend/gamecfgwidget.cpp	Sat Dec 18 15:14:27 2010 +0100
@@ -58,6 +58,7 @@
     for (int i = 0; i < scriptList->size(); ++i) {
         QString script = (*scriptList)[i].remove(".lua", Qt::CaseInsensitive);
         QList<QVariant> scriptInfo;
+        scriptInfo.push_back(script);
         QFile scriptCfgFile(QString("%1/Scripts/Multiplayer/%2.cfg").arg(datadir->absolutePath()).arg(script));
         if (scriptCfgFile.exists() && scriptCfgFile.open(QFile::ReadOnly)) {
             QString scheme;
@@ -80,7 +81,7 @@
             scriptInfo.push_back("locked");
             scriptInfo.push_back("locked");
         }
-        Scripts->addItem(script, scriptInfo);
+        Scripts->addItem(script.replace("_", " "), scriptInfo);
     }
 
     connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int)));
@@ -271,7 +272,7 @@
 
     if (Scripts->currentIndex() > 0)
     {
-        bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->currentText()).toUtf8();
+        bcfg << QString("escript Scripts/Multiplayer/%1.lua").arg(Scripts->itemData(Scripts->currentIndex()).toList()[0].toString()).toUtf8();
     }
 
     QByteArray result;
@@ -473,8 +474,8 @@
 {
     if(index > 0)
     {
-        QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[0].toString();
-        QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString();
+        QString scheme = Scripts->itemData(Scripts->currentIndex()).toList()[1].toString();
+        QString weapons = Scripts->itemData(Scripts->currentIndex()).toList()[2].toString();
 
         if (scheme == "locked")
         {
--- a/QTfrontend/mapContainer.cpp	Sat Dec 18 15:14:16 2010 +0100
+++ b/QTfrontend/mapContainer.cpp	Sat Dec 18 15:14:27 2010 +0100
@@ -176,7 +176,7 @@
     gbThemes->setTitle(tr("Themes"));
 
     //gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
-    mainLayout.addWidget(gbThemes, 0, 2, 3, 1);
+    mainLayout.addWidget(gbThemes, 0, 2, 3, 2);
 
     QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
     gbTLayout->setContentsMargins(0, 0, 0 ,0);
@@ -213,8 +213,12 @@
     QLabel* seedLabel = new QLabel(tr("Seed"), this);
     mainLayout.addWidget(seedLabel, 3, 0);
     seedEdit = new QLineEdit(this);
+    connect(seedEdit, SIGNAL(returnPressed()), this, SLOT(seedEdited()));
     mainLayout.addWidget(seedEdit, 3, 1, 1, 2);
-    connect(seedEdit, SIGNAL(textChanged(const QString&)), this, SLOT(seedEdited(const QString&)));
+    seedSet = new QPushButton(this);
+    seedSet->setText(QPushButton::tr("Set"));
+    connect(seedSet, SIGNAL(clicked()), this, SLOT(seedEdited()));
+    mainLayout.addWidget(seedSet, 3, 3);
 
     mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
 
@@ -550,14 +554,14 @@
     return drawMapScene.encode();
 }
 
-void HWMapContainer::seedEdited(const QString & seed)
+void HWMapContainer::seedEdited()
 {
-    if (seed.isEmpty() || seed.size() > 54)
+    if (seedEdit->text().isEmpty() || seedEdit->text().size() > 54)
         seedEdit->setText(m_seed);
     else
     {
-        setSeed(seed);
-        emit seedChanged(seed);
+        setSeed(seedEdit->text());
+        emit seedChanged(seedEdit->text());
     }
 }
 
@@ -571,4 +575,4 @@
     emit drawnMapChanged(getDrawnMapData());
 
     changeImage();
-}
\ No newline at end of file
+}
--- a/QTfrontend/mapContainer.h	Sat Dec 18 15:14:16 2010 +0100
+++ b/QTfrontend/mapContainer.h	Sat Dec 18 15:14:27 2010 +0100
@@ -89,7 +89,7 @@
   void themeSelected(int currentRow);
   void addInfoToPreview(QPixmap image);
   void templateFilterChanged(int filter);
-  void seedEdited(const QString & seed);
+  void seedEdited();
 
  protected:
   virtual void resizeEvent ( QResizeEvent * event );
@@ -103,6 +103,7 @@
   HWMap* pMap;
   QString m_seed;
   QLineEdit* seedEdit;
+  QPushButton* seedSet;
   int hhLimit;
   int templateFilter;
   QPixmap hhSmall;
--- a/hedgewars/uVariables.pas	Sat Dec 18 15:14:16 2010 +0100
+++ b/hedgewars/uVariables.pas	Sat Dec 18 15:14:27 2010 +0100
@@ -23,7 +23,7 @@
     cReducedQuality : LongWord    = rqNone;
     //userNick is in uChat
     recordFileName  : shortstring = '';
-    cReadyDelay     : Longword    = 5000;
+    cReadyDelay     : Longword    = 0;
     cLogfileBase    : shortstring = 'debug';
 //////////////////////////
 
@@ -2248,7 +2248,7 @@
     cReducedQuality := rqNone;
     //userNick is in uChat
     recordFileName  := '';
-    cReadyDelay     := 5000;
+    cReadyDelay     := 0;
 end;
 
 end.
--- a/share/hedgewars/Data/Scripts/Multiplayer/RandomWeapon.cfg	Sat Dec 18 15:14:16 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Default
-locked
--- a/share/hedgewars/Data/Scripts/Multiplayer/RandomWeapon.lua	Sat Dec 18 15:14:16 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun,
-            amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer,
-            amBaseballBat, amAirAttack, amMineStrike, amTeleport, amMortar, amCake,
-            amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun,
-            amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch,
-            amGasBomb, amFlamethrower, amSMine, amHammer, amDrillStrike }
-
-local lastRound = -1
-local weapon = 0
-
-function onGameInit()
-    GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack + gfPerHogAmmo))
-end
-
-function onAmmoStoreInit()
-    SetAmmo(amSkip, 9, 0, 0, 0)
-
-    SetAmmo(amParachute, 0, 1, 0, 1)
-    SetAmmo(amGirder, 0, 1, 0, 2)
-    SetAmmo(amSwitch, 0, 1, 0, 1)
-    SetAmmo(amLowGravity, 0, 1, 0, 1)
-    SetAmmo(amExtraDamage, 0, 1, 0, 1)
-    SetAmmo(amInvulnerable, 0, 1, 0, 1)
-    SetAmmo(amExtraTime, 0, 1, 0, 1)
-    SetAmmo(amLaserSight, 0, 1, 0, 1)
-    SetAmmo(amVampiric, 0, 1, 0, 1)
-    SetAmmo(amJetpack, 0, 1, 0, 1)
-    SetAmmo(amPortalGun, 0, 1, 0, 1)
-    SetAmmo(amResurrector, 0, 1, 0, 1)
-
-    for i, w in pairs(weapons) do
-        SetAmmo(w, 0, 0, 0, 1)
-    end
-end
-
-function onNewTurn()
-    if lastRound ~= TotalRounds then
-        weapon = GetRandom(table.maxn(weapons)) + 1
-        lastRound = TotalRounds
-    end
-    AddAmmo(CurrentHedgehog, weapons[weapon])
-end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.cfg	Sat Dec 18 15:14:27 2010 +0100
@@ -0,0 +1,2 @@
+Default
+locked
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Random_Weapon.lua	Sat Dec 18 15:14:27 2010 +0100
@@ -0,0 +1,42 @@
+local weapons = { amGrenade, amClusterBomb, amBazooka, amBee, amShotgun,
+            amMine, amDEagle, amDynamite, amFirePunch, amWhip, amPickHammer,
+            amBaseballBat, amAirAttack, amMineStrike, amTeleport, amMortar, amCake,
+            amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun,
+            amRCPlane, amSniperRifle, amMolotov, amBirdy, amBlowTorch,
+            amGasBomb, amFlamethrower, amSMine, amHammer, amDrillStrike }
+
+local lastRound = -1
+local weapon = 0
+
+function onGameInit()
+    GameFlags = band(bor(GameFlags, gfResetWeps), bnot(gfInfAttack + gfPerHogAmmo))
+end
+
+function onAmmoStoreInit()
+    SetAmmo(amSkip, 9, 0, 0, 0)
+
+    SetAmmo(amParachute, 0, 1, 0, 1)
+    SetAmmo(amGirder, 0, 1, 0, 2)
+    SetAmmo(amSwitch, 0, 1, 0, 1)
+    SetAmmo(amLowGravity, 0, 1, 0, 1)
+    SetAmmo(amExtraDamage, 0, 1, 0, 1)
+    SetAmmo(amInvulnerable, 0, 1, 0, 1)
+    SetAmmo(amExtraTime, 0, 1, 0, 1)
+    SetAmmo(amLaserSight, 0, 1, 0, 1)
+    SetAmmo(amVampiric, 0, 1, 0, 1)
+    SetAmmo(amJetpack, 0, 1, 0, 1)
+    SetAmmo(amPortalGun, 0, 1, 0, 1)
+    SetAmmo(amResurrector, 0, 1, 0, 1)
+
+    for i, w in pairs(weapons) do
+        SetAmmo(w, 0, 0, 0, 1)
+    end
+end
+
+function onNewTurn()
+    if lastRound ~= TotalRounds then
+        weapon = GetRandom(table.maxn(weapons)) + 1
+        lastRound = TotalRounds
+    end
+    AddAmmo(CurrentHedgehog, weapons[weapon])
+end