# HG changeset patch # User unc0rr # Date 1256930924 0 # Node ID 0047e16dbacb780dc861639c308fa249a74481aa # Parent dd995a9c8871cf48058d92aaa23c4f53551600cf Add loading team parameters diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/editor.cpp --- 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 +#include #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(ui->twTeams->widget(currTeam)); + te->addTeam(teamName, teamColor); + } + else + if (line.startsWith("fort") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); + te->setFort(line.mid(5)); + } + else + if (line.startsWith("grave") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); + te->setGrave(line.mid(6)); + } + else + if (line.startsWith("voicepack") && (currTeam >= 0)) + { + TeamEdit * te = qobject_cast(ui->twTeams->widget(currTeam)); + te->setVoicepack(line.mid(10)); + } } } diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/editor.ui --- a/tools/MissionsEditor/editor.ui Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/editor.ui Fri Oct 30 19:28:44 2009 +0000 @@ -285,7 +285,61 @@ - + + + Add Team + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 + + + + Team 1 + + + + + Team 2 + + + + + Team 3 + + + + + Team 4 + + + + + Team 5 + + + + + Team 6 + + + diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.cpp --- a/tools/MissionsEditor/teamedit.cpp Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.cpp Fri Oct 30 19:28:44 2009 +0000 @@ -24,3 +24,24 @@ break; } } + +void TeamEdit::addTeam(const QString & teamName, quint32 color) +{ + m_ui->leTeamName->setText(teamName); +} + +void TeamEdit::setFort(const QString & name) +{ + m_ui->leFort->setText(name); +} + +void TeamEdit::setGrave(const QString & name) +{ + m_ui->leGrave->setText(name); +} + +void TeamEdit::setVoicepack(const QString & name) +{ + m_ui->leVoicepack->setText(name); +} + diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.h --- a/tools/MissionsEditor/teamedit.h Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.h Fri Oct 30 19:28:44 2009 +0000 @@ -13,6 +13,10 @@ TeamEdit(QWidget *parent = 0); ~TeamEdit(); + void addTeam(const QString & teamName = QString(), quint32 color = 0xdd0000); + void setFort(const QString & name); + void setGrave(const QString & name); + void setVoicepack(const QString & name); protected: void changeEvent(QEvent *e); diff -r dd995a9c8871 -r 0047e16dbacb tools/MissionsEditor/teamedit.ui --- a/tools/MissionsEditor/teamedit.ui Thu Oct 29 23:59:46 2009 +0000 +++ b/tools/MissionsEditor/teamedit.ui Fri Oct 30 19:28:44 2009 +0000 @@ -6,113 +6,119 @@ 0 0 - 437 - 354 + 450 + 414 Form - - - + + + + + + + Team name + + + + + + + + + + + + + Colour + + + + + + + Fort + + + + + + + Grave + + + + + + + + + + + + + Voicepack + + + + + + + + + + + + + Name + + + + + Health + + + + + Spawn pos + + + + + + - Add Team + Add hedgehog - - + + + + Delete hedgehog + + + + + - Qt::Horizontal + Qt::Vertical - 331 - 20 + 117 + 125 - - - - 0 + + + + Delete team - - - Team - - - - - - - - Team name - - - - - - - - - - - - - Name - - - - - Health - - - - - Spawn pos - - - - - - - - Add hedgehog - - - - - - - Delete hedgehog - - - - - - - Qt::Vertical - - - - 117 - 102 - - - - - - - - Delete team - - - - -