QTfrontend/team.h
changeset 6015 daffc14a518a
parent 4976 088d40d8aba2
child 6024 d38da7c19e43
equal deleted inserted replaced
6014:b432c4b9cc9b 6015:daffc14a518a
    22 
    22 
    23 #include <QColor>
    23 #include <QColor>
    24 #include <QString>
    24 #include <QString>
    25 #include "binds.h"
    25 #include "binds.h"
    26 #include "achievements.h"
    26 #include "achievements.h"
       
    27 #include "hwconsts.h"
    27 
    28 
    28 class HWForm;
    29 class HWForm;
    29 class GameUIConfig;
    30 class GameUIConfig;
    30 
    31 
    31 class HWTeamConstructException
    32 class HWTeamConstructException
    32 {
    33 {
    33 };
    34 };
    34 
    35 
       
    36 // structure for customization and statistics of a single hedgehog
    35 struct HWHog
    37 struct HWHog
    36 {
    38 {
    37     QString Name;
    39     QString Name;
    38     QString Hat;
    40     QString Hat;
    39     int Rounds, Kills, Deaths, Suicides;
    41     int Rounds, Kills, Deaths, Suicides;
    40 };
    42 };
    41 
    43 
       
    44 // class representing a team
    42 class HWTeam
    45 class HWTeam
    43 {
    46 {
    44     public:
    47     public:
       
    48 
       
    49         // constructors
    45         HWTeam(const QString & teamname);
    50         HWTeam(const QString & teamname);
    46         HWTeam(const QStringList& strLst);
    51         HWTeam(const QStringList& strLst);
    47         HWTeam();
    52         HWTeam();
    48 
    53 
    49         bool isNetTeam() const;
    54         // file operations
       
    55         bool loadFromFile();
       
    56         bool deleteFile();
       
    57         bool saveToFile();
       
    58         bool fileExists();
    50 
    59 
    51         QString TeamName;
    60         // attribute getters
    52         QString Grave;
    61          unsigned int campaignProgress() const;
    53         QString Fort;
    62                QColor color() const;
    54         QString Flag;
    63          unsigned int difficulty() const;
    55         QString Voicepack;
    64               QString flag() const;
    56         QString Owner;
    65               QString fort() const;
    57         int Rounds;
    66               QString grave() const;
    58         int Wins;
    67         const HWHog & hedgehog(unsigned int idx) const;
    59         int CampaignProgress;
    68                  bool isNetTeam() const;
    60         HWHog Hedgehogs[8];
    69               QString name() const;
    61         unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
    70         unsigned char numHedgehogs() const;
    62         unsigned int difficulty;
    71               QString owner() const;
       
    72               QString voicepack() const;
       
    73 
       
    74         // attribute setters
       
    75         void setColor(const QColor & color);
       
    76         void setDifficulty(unsigned int level);
       
    77         void setFlag(const QString & flag);
       
    78         void setFort(const QString & fort);
       
    79         void setGrave(const QString & grave);
       
    80         void setHedgehog(unsigned int idx, const HWHog & hh);
       
    81         void setName(const QString & name);
       
    82         void setNumHedgehogs(unsigned char num);
       
    83         void setVoicepack(const QString & voicepack);
       
    84 
       
    85         // increments for statistical info
       
    86         void incRounds();
       
    87         void incWins();
       
    88 
       
    89         // pages... wait... wth is THIS doing in this class? FIXME!!!!
       
    90         void SetToPage(HWForm * hwform);
       
    91         void GetFromPage(HWForm * hwform);
       
    92 
       
    93         // convert team info into strings for further computation
       
    94         QStringList teamGameConfig(quint32 InitHealth) const;
       
    95 
       
    96         // comparison operators
       
    97         bool operator==(const HWTeam& t1) const;
       
    98         bool operator<(const HWTeam& t1) const;
       
    99 
       
   100 
       
   101 
       
   102     private:
       
   103 
       
   104         QString OldTeamName;
       
   105 
       
   106         // class members that contain the general team info and settings
       
   107         QString m_name;
       
   108         QString m_grave;
       
   109         QString m_fort;
       
   110         QString m_flag;
       
   111         QString m_voicepack;
       
   112         HWHog m_hedgehogs[HEDGEHOGS_PER_TEAM];
       
   113         unsigned int m_difficulty;
    63         BindAction binds[BINDS_NUMBER];
   114         BindAction binds[BINDS_NUMBER];
    64 
   115 
    65         unsigned char numHedgehogs;
   116         // class members that contain info for the current game setup
    66         QColor teamColor;
   117         unsigned char m_numHedgehogs;
       
   118         QColor m_color;
       
   119         bool m_isNetTeam;
       
   120         QString m_owner;
    67 
   121 
    68         bool LoadFromFile();
   122         // class members that contain statistics, etc.
    69         bool DeleteFile();
   123         unsigned int m_campaignProgress;
    70         bool SaveToFile();
   124         unsigned int m_rounds;
    71         bool FileExists();
   125         unsigned int m_wins;
    72         void SetToPage(HWForm * hwform);
   126         unsigned int AchievementProgress[MAX_ACHIEVEMENTS];
    73         void GetFromPage(HWForm * hwform);
       
    74         QStringList TeamGameConfig(quint32 InitHealth) const;
       
    75 
   127 
    76         bool operator==(const HWTeam& t1) const;
       
    77         bool operator<(const HWTeam& t1) const;
       
    78     private:
       
    79         bool m_isNetTeam;
       
    80         QString OldTeamName;
       
    81 
   128 
    82 };
   129 };
    83 
   130 
    84 #endif
   131 #endif