QTfrontend/team.cpp
changeset 14477 4b678aad50e9
parent 13708 3264a26bbf8b
child 14529 db646b3c0b95
--- a/QTfrontend/team.cpp	Wed Dec 19 05:50:02 2018 +0100
+++ b/QTfrontend/team.cpp	Wed Dec 19 19:10:42 2018 +0100
@@ -35,6 +35,7 @@
     , m_difficulty(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(false)
+    , m_isMissionTeam(false)
 {
     m_name = teamname;
     OldTeamName = m_name;
@@ -61,6 +62,7 @@
     QObject(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(true)
+    , m_isMissionTeam(false)
 {
     // net teams are configured from QStringList
     if(strLst.size() != 23) throw HWTeamConstructException();
@@ -88,6 +90,7 @@
     , m_difficulty(0)
     , m_numHedgehogs(4)
     , m_isNetTeam(false)
+    , m_isMissionTeam(false)
 {
     m_name = QString("Team");
     for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
@@ -125,6 +128,7 @@
     , m_numHedgehogs(other.m_numHedgehogs)
     , m_color(other.m_color)
     , m_isNetTeam(other.m_isNetTeam)
+    , m_isMissionTeam(other.m_isMissionTeam)
     , m_owner(other.m_owner)
 //      , AchievementProgress(other.AchievementProgress)
 {
@@ -149,6 +153,7 @@
         m_isNetTeam = other.m_isNetTeam;
         m_owner = other.m_owner;
         m_color = other.m_color;
+        m_isMissionTeam = other.m_isMissionTeam;
     }
 
     return *this;
@@ -243,12 +248,25 @@
 QStringList HWTeam::teamGameConfig(quint32 InitHealth) const
 {
     QStringList sl;
+    QString cmdAddHog = "eaddhh";
+
     if (m_isNetTeam)
     {
         sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(QString(QCryptographicHash::hash(m_owner.toUtf8(), QCryptographicHash::Md5).toHex())));
         sl.push_back("erdriven");
     }
-    else sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+    else
+    {
+        if (m_isMissionTeam)
+        {
+            sl.push_back(QString("esetmissteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+            cmdAddHog = "eaddmisshh";
+        }
+        else
+        {
+            sl.push_back(QString("eaddteam %3 %1 %2").arg(qcolor().rgb() & 0xffffff).arg(m_name).arg(playerHash));
+        }
+    }
 
     sl.push_back(QString("egrave " + m_grave));
     sl.push_back(QString("efort " + m_fort));
@@ -260,7 +278,7 @@
 
     for (int t = 0; t < m_numHedgehogs; t++)
     {
-        sl.push_back(QString("eaddhh %1 %2 %3")
+        sl.push_back(QString(cmdAddHog + " %1 %2 %3")
                      .arg(QString::number(m_difficulty),
                           QString::number(InitHealth),
                           m_hedgehogs[t].Name));
@@ -281,6 +299,15 @@
     return m_isNetTeam;
 }
 
+void HWTeam::setMissionTeam(bool isMissionTeam)
+{
+    m_isMissionTeam = isMissionTeam;
+}
+
+bool HWTeam::isMissionTeam() const
+{
+    return m_isMissionTeam;
+}
 
 bool HWTeam::operator==(const HWTeam& t1) const
 {