tools/MissionsEditor/editor.cpp
changeset 2594 0047e16dbacb
parent 2584 cc049fbb65ef
child 2596 41b46f83d088
--- a/tools/MissionsEditor/editor.cpp	Thu Oct 29 23:59:46 2009 +0000
+++ b/tools/MissionsEditor/editor.cpp	Fri Oct 30 19:28:44 2009 +0000
@@ -1,4 +1,5 @@
 #include <QtGui>
+#include <QObject>
 #include "editor.h"
 #include "ui_editor.h"
 
@@ -39,6 +40,8 @@
 
 void editor::load(const QString & fileName)
 {
+    int currTeam = -1;
+
     QFile file(fileName);
 
     if(!file.open(QIODevice::ReadOnly))
@@ -79,5 +82,35 @@
                 flags >>= 1;
             }
         }
+        else
+        if (line.startsWith("addteam") && (currTeam < 5))
+        {
+            ++currTeam;
+            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);
+        }
+        else
+        if (line.startsWith("fort") && (currTeam >= 0))
+        {
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->setFort(line.mid(5));
+        }
+        else
+        if (line.startsWith("grave") && (currTeam >= 0))
+        {
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->setGrave(line.mid(6));
+        }
+        else
+        if (line.startsWith("voicepack") && (currTeam >= 0))
+        {
+            TeamEdit * te = qobject_cast<TeamEdit *>(ui->twTeams->widget(currTeam));
+            te->setVoicepack(line.mid(10));
+        }
     }
 }