--- a/QTfrontend/team.cpp Wed May 16 18:22:28 2018 +0200
+++ b/QTfrontend/team.cpp Wed Jul 31 23:14:27 2019 +0200
@@ -35,6 +35,7 @@
, m_difficulty(0)
, m_numHedgehogs(4)
, m_isNetTeam(false)
+ , m_isMissionTeam(false)
{
m_name = teamname;
OldTeamName = m_name;
@@ -54,9 +55,6 @@
m_binds[i].action = cbinds[i].action;
m_binds[i].strbind = QString();
}
- m_rounds = 0;
- m_wins = 0;
- m_campaignProgress = 0;
m_color = 0;
}
@@ -64,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();
@@ -83,9 +82,6 @@
// Checking net teams is probably pointless, but can't hurt.
if (m_hedgehogs[i].Hat.isEmpty()) m_hedgehogs[i].Hat = "NoHat";
}
- m_rounds = 0;
- m_wins = 0;
- m_campaignProgress = 0;
m_color = 0;
}
@@ -94,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++)
@@ -114,9 +111,6 @@
m_binds[i].action = cbinds[i].action;
m_binds[i].strbind = QString();
}
- m_rounds = 0;
- m_wins = 0;
- m_campaignProgress = 0;
m_color = 0;
}
@@ -134,10 +128,8 @@
, 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)
- , m_campaignProgress(other.m_campaignProgress)
- , m_rounds(other.m_rounds)
- , m_wins(other.m_wins)
// , AchievementProgress(other.AchievementProgress)
{
@@ -160,10 +152,8 @@
m_color = other.m_color;
m_isNetTeam = other.m_isNetTeam;
m_owner = other.m_owner;
- m_campaignProgress = other.m_campaignProgress;
- m_rounds = other.m_rounds;
- m_wins = other.m_wins;
m_color = other.m_color;
+ m_isMissionTeam = other.m_isMissionTeam;
}
return *this;
@@ -179,18 +169,11 @@
m_voicepack = teamfile.value("Team/Voicepack", "Default").toString();
m_flag = teamfile.value("Team/Flag", "hedgewars").toString();
m_difficulty = teamfile.value("Team/Difficulty", 0).toInt();
- m_rounds = teamfile.value("Team/Rounds", 0).toInt();
- m_wins = teamfile.value("Team/Wins", 0).toInt();
- m_campaignProgress = teamfile.value("Team/CampaignProgress", 0).toInt();
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
QString hh = QString("Hedgehog%1/").arg(i);
m_hedgehogs[i].Name = teamfile.value(hh + "Name", QString("Hedgehog %1").arg(i+1)).toString();
m_hedgehogs[i].Hat = teamfile.value(hh + "Hat", "NoHat").toString();
- m_hedgehogs[i].Rounds = teamfile.value(hh + "Rounds", 0).toInt();
- m_hedgehogs[i].Kills = teamfile.value(hh + "Kills", 0).toInt();
- m_hedgehogs[i].Deaths = teamfile.value(hh + "Deaths", 0).toInt();
- m_hedgehogs[i].Suicides = teamfile.value(hh + "Suicides", 0).toInt();
}
for(int i = 0; i < BINDS_NUMBER; i++)
m_binds[i].strbind = teamfile.value(QString("Binds/%1").arg(m_binds[i].action), QString()).toString();
@@ -244,22 +227,18 @@
teamfile.setValue("Team/Voicepack", m_voicepack);
teamfile.setValue("Team/Flag", m_flag);
teamfile.setValue("Team/Difficulty", m_difficulty);
- teamfile.setValue("Team/Rounds", m_rounds);
- teamfile.setValue("Team/Wins", m_wins);
- teamfile.setValue("Team/CampaignProgress", m_campaignProgress);
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
{
QString hh = QString("Hedgehog%1/").arg(i);
teamfile.setValue(hh + "Name", m_hedgehogs[i].Name);
teamfile.setValue(hh + "Hat", m_hedgehogs[i].Hat);
- teamfile.setValue(hh + "Rounds", m_hedgehogs[i].Rounds);
- teamfile.setValue(hh + "Kills", m_hedgehogs[i].Kills);
- teamfile.setValue(hh + "Deaths", m_hedgehogs[i].Deaths);
- teamfile.setValue(hh + "Suicides", m_hedgehogs[i].Suicides);
}
for(int i = 0; i < BINDS_NUMBER; i++)
- teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind);
+ {
+ if(QString(m_binds[i].action) != QString("!MULTI"))
+ teamfile.setValue(QString("Binds/%1").arg(m_binds[i].action), m_binds[i].strbind);
+ }
for(int i = 0; i < MAX_ACHIEVEMENTS; i++)
if(achievements[i][0][0])
teamfile.setValue(QString("Achievements/%1").arg(achievements[i][0]), AchievementProgress[i]);
@@ -272,12 +251,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));
@@ -289,7 +281,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));
@@ -310,6 +302,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
{
@@ -351,6 +352,10 @@
return m_owner;
}
+void HWTeam::setOwner(const QString & owner)
+{
+ m_owner = owner;
+}
// difficulty
@@ -430,13 +435,6 @@
return m_voicepack;
}
-
-// campaignProgress - getter
-unsigned int HWTeam::campaignProgress() const
-{
- return m_campaignProgress;
-};
-
// amount of hedgehogs
unsigned char HWTeam::numHedgehogs() const
{
@@ -447,15 +445,3 @@
m_numHedgehogs = num;
}
-
-
-// rounds+wins - incrementors
-void HWTeam::incRounds()
-{
- m_rounds++;
-}
-void HWTeam::incWins()
-{
- m_wins++;
-}
-