tools/MissionsEditor/editor.cpp
changeset 2596 41b46f83d088
parent 2594 0047e16dbacb
--- a/tools/MissionsEditor/editor.cpp	Fri Oct 30 19:41:39 2009 +0000
+++ b/tools/MissionsEditor/editor.cpp	Sun Nov 01 17:19:55 2009 +0000
@@ -8,6 +8,8 @@
 {
     ui->setupUi(this);
 
+    reset();
+
     cbFlags
         << ui->cbForts
         << ui->cbMultiWeapon
@@ -30,6 +32,15 @@
     delete ui;
 }
 
+void editor::reset()
+{
+    for(int i = 0; i < 6; ++i)
+    {
+        ui->twTeams->setTabEnabled(i, false);
+        ui->twTeams->widget(i)->setEnabled(false);
+    }
+}
+
 void editor::on_actionLoad_triggered()
 {
     QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), "Missions (*.txt)");
@@ -86,13 +97,29 @@
         if (line.startsWith("addteam") && (currTeam < 5))
         {
             ++currTeam;
+            ui->twTeams->setTabEnabled(currTeam, true);
+            ui->twTeams->widget(currTeam)->setEnabled(true);
+
             line = line.mid(8);
             int spacePos = line.indexOf('\x20');
             quint32 teamColor = line.left(spacePos).toUInt();
             QString teamName = line.mid(spacePos + 1);
 
             TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
-            te->addTeam(teamName, teamColor);
+            te->setTeam(teamName, teamColor);
+        }
+        else
+        if (line.startsWith("addhh") && (currTeam >= 0))
+        {
+            line = line.mid(6);
+            quint32 level = line.left(1).toUInt();
+            line = line.mid(2);
+            int spacePos = line.indexOf('\x20');
+            quint32 health = line.left(spacePos).toUInt();
+            QString hhName = line.mid(spacePos + 1);
+
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->addHedgehog(level, health, hhName);
         }
         else
         if (line.startsWith("fort") && (currTeam >= 0))
@@ -101,6 +128,23 @@
             te->setFort(line.mid(5));
         }
         else
+        if (line.startsWith("hat") && (currTeam >= 0))
+        {
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->setLastHHHat(line.mid(4));
+        }
+        else
+        if (line.startsWith("hhcoords") && (currTeam >= 0))
+        {
+            line = line.mid(9);
+            int spacePos = line.indexOf('\x20');
+            int x = line.left(spacePos).toUInt();
+            int y = line.mid(spacePos + 1).toInt();
+
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->setLastHHCoords(x, y);
+        }
+        else
         if (line.startsWith("grave") && (currTeam >= 0))
         {
             TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));