QTfrontend/team.h
branchhedgeroid
changeset 15515 7030706266df
parent 14534 db646b3c0b95
equal deleted inserted replaced
7861:bc7b6aa5d67a 15515:7030706266df
     1 /*
     1 /*
     2  * Hedgewars, a free turn based strategy game
     2  * Hedgewars, a free turn based strategy game
     3  * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
     4  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
     4  * Copyright (c) 2007 Igor Ulyanov <iulyanov@gmail.com>
     5  *
     5  *
     6  * This program is free software; you can redistribute it and/or modify
     6  * This program is free software; you can redistribute it and/or modify
     7  * it under the terms of the GNU General Public License as published by
     7  * it under the terms of the GNU General Public License as published by
     8  * the Free Software Foundation; version 2 of the License
     8  * the Free Software Foundation; version 2 of the License
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  * GNU General Public License for more details.
    13  * GNU General Public License for more details.
    14  *
    14  *
    15  * You should have received a copy of the GNU General Public License
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program; if not, write to the Free Software
    16  * along with this program; if not, write to the Free Software
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18  */
    18  */
    19 
    19 
    20 #ifndef TEAM_H
    20 #ifndef TEAM_H
    21 #define TEAM_H
    21 #define TEAM_H
    22 
    22 
    36 // structure for customization and statistics of a single hedgehog
    36 // structure for customization and statistics of a single hedgehog
    37 struct HWHog
    37 struct HWHog
    38 {
    38 {
    39     QString Name;
    39     QString Name;
    40     QString Hat;
    40     QString Hat;
    41     int Rounds, Kills, Deaths, Suicides;
    41 
       
    42     HWHog(){}
    42 };
    43 };
    43 
    44 
    44 // class representing a team
    45 // class representing a team
    45 class HWTeam : public QObject
    46 class HWTeam : public QObject
    46 {
    47 {
    58         static HWTeam loadFromFile(const QString & teamName);
    59         static HWTeam loadFromFile(const QString & teamName);
    59         bool loadFromFile();
    60         bool loadFromFile();
    60         bool deleteFile();
    61         bool deleteFile();
    61         bool saveToFile();
    62         bool saveToFile();
    62         bool fileExists();
    63         bool fileExists();
       
    64         bool wouldOverwriteOtherFile();
    63 
    65 
    64         // attribute getters
    66         // attribute getters
    65         unsigned int campaignProgress() const;
       
    66         int color() const;
    67         int color() const;
    67         QColor qcolor() const;
    68         QColor qcolor() const;
    68         unsigned int difficulty() const;
    69         unsigned int difficulty() const;
    69         QString flag() const;
    70         QString flag() const;
    70         QString fort() const;
    71         QString fort() const;
    71         QString grave() const;
    72         QString grave() const;
    72         const HWHog & hedgehog(unsigned int idx) const;
    73         const HWHog & hedgehog(unsigned int idx) const;
    73         bool isNetTeam() const;
    74         bool isNetTeam() const;
       
    75         bool isMissionTeam() const;
    74         QString keyBind(unsigned int idx) const;
    76         QString keyBind(unsigned int idx) const;
    75         QString name() const;
    77         QString name() const;
    76         unsigned char numHedgehogs() const;
    78         unsigned char numHedgehogs() const;
    77         QString owner() const;
    79         QString owner() const;
       
    80         void setOwner(const QString & owner);
    78         QString voicepack() const;
    81         QString voicepack() const;
    79 
    82 
    80         // attribute setters
    83         // attribute setters
    81         void bindKey(unsigned int idx, const QString & key);
    84         void bindKey(unsigned int idx, const QString & key);
    82         void setDifficulty(unsigned int level);
    85         void setDifficulty(unsigned int level);
    85         void setGrave(const QString & grave);
    88         void setGrave(const QString & grave);
    86         void setHedgehog(unsigned int idx, HWHog hh);
    89         void setHedgehog(unsigned int idx, HWHog hh);
    87         void setName(const QString & name);
    90         void setName(const QString & name);
    88         void setNumHedgehogs(unsigned char num);
    91         void setNumHedgehogs(unsigned char num);
    89         void setVoicepack(const QString & voicepack);
    92         void setVoicepack(const QString & voicepack);
    90 
    93         void setNetTeam(bool isNetTeam);
    91         // increments for statistical info
    94         void setMissionTeam(bool isMissionTeam);
    92         void incRounds();
       
    93         void incWins();
       
    94 
    95 
    95         // convert team info into strings for further computation
    96         // convert team info into strings for further computation
    96         QStringList teamGameConfig(quint32 InitHealth) const;
    97         QStringList teamGameConfig(quint32 InitHealth) const;
    97 
    98 
    98         // comparison operators
    99         // comparison operators
   119 
   120 
   120         // class members that contain info for the current game setup
   121         // class members that contain info for the current game setup
   121         quint8 m_numHedgehogs;
   122         quint8 m_numHedgehogs;
   122         int m_color;
   123         int m_color;
   123         bool m_isNetTeam;
   124         bool m_isNetTeam;
       
   125         bool m_isMissionTeam;
   124         QString m_owner;
   126         QString m_owner;
   125 
   127 
   126         // class members that contain statistics, etc.
   128         // class members that contain statistics, etc.
   127         unsigned int m_campaignProgress;
       
   128         unsigned int m_rounds;
       
   129         unsigned int m_wins;
       
   130         unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
   129         unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
   131 };
   130 };
   132 
   131 
   133 #endif
   132 #endif