Remove frontend code dealing with unused team variables
authorWuzzy <Wuzzy2@mail.ru>
Sun, 26 Aug 2018 20:50:51 +0200
changeset 13708 3264a26bbf8b
parent 13707 043f694d25d9
child 13709 e2b1abb4fba5
child 13795 e335daaa77a9
Remove frontend code dealing with unused team variables
QTfrontend/team.cpp
QTfrontend/team.h
QTfrontend/ui/page/pagegamestats.cpp
--- a/QTfrontend/team.cpp	Sun Aug 26 17:59:26 2018 +0200
+++ b/QTfrontend/team.cpp	Sun Aug 26 20:50:51 2018 +0200
@@ -54,9 +54,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;
 }
 
@@ -83,9 +80,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;
 }
 
@@ -114,9 +108,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;
 }
 
@@ -135,9 +126,6 @@
     , 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)
 //      , AchievementProgress(other.AchievementProgress)
 {
 
@@ -160,9 +148,6 @@
         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;
     }
 
@@ -179,18 +164,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,19 +222,12 @@
     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);
@@ -430,13 +401,6 @@
     return m_voicepack;
 }
 
-
-// campaignProgress - getter
-unsigned int HWTeam::campaignProgress() const
-{
-    return m_campaignProgress;
-};
-
 // amount of hedgehogs
 unsigned char HWTeam::numHedgehogs() const
 {
@@ -447,15 +411,3 @@
     m_numHedgehogs = num;
 }
 
-
-
-// rounds+wins - incrementors
-void HWTeam::incRounds()
-{
-    m_rounds++;
-}
-void HWTeam::incWins()
-{
-    m_wins++;
-}
-
--- a/QTfrontend/team.h	Sun Aug 26 17:59:26 2018 +0200
+++ b/QTfrontend/team.h	Sun Aug 26 20:50:51 2018 +0200
@@ -38,9 +38,8 @@
 {
     QString Name;
     QString Hat;
-    int Rounds, Kills, Deaths, Suicides;
 
-    HWHog() : Rounds(0), Kills(0), Deaths(0), Suicides(0){}
+    HWHog(){}
 };
 
 // class representing a team
@@ -65,7 +64,6 @@
         bool wouldOverwriteOtherFile();
 
         // attribute getters
-        unsigned int campaignProgress() const;
         int color() const;
         QColor qcolor() const;
         unsigned int difficulty() const;
@@ -92,10 +90,6 @@
         void setVoicepack(const QString & voicepack);
         void setNetTeam(bool isNetTeam);
 
-        // increments for statistical info
-        void incRounds();
-        void incWins();
-
         // convert team info into strings for further computation
         QStringList teamGameConfig(quint32 InitHealth) const;
 
@@ -128,9 +122,6 @@
         QString m_owner;
 
         // class members that contain statistics, etc.
-        unsigned int m_campaignProgress;
-        unsigned int m_rounds;
-        unsigned int m_wins;
         unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
 };
 
--- a/QTfrontend/ui/page/pagegamestats.cpp	Sun Aug 26 17:59:26 2018 +0200
+++ b/QTfrontend/ui/page/pagegamestats.cpp	Sun Aug 26 20:50:51 2018 +0200
@@ -299,17 +299,7 @@
         }
         case 'T':   // local team stats
         {
-            //AddStatText("<p>local team: " + info + "</p>");
-            QStringList infol = info.split(":");
-            HWTeam team(infol[0]);
-            if(team.fileExists()) // do some better test to avoid influence from scripted/predefined teams?
-            {
-                team.loadFromFile();
-                team.incRounds();
-                if(infol[1].toInt() > 0) // might require some better test for winning condition (or changed flag) ... WIP!
-                    team.incWins(); // should draws count as wins?
-                //team.SaveToFile(); // don't save yet
-            }
+            // unused
             break;
         }
         case 'p' :