QTfrontend/team.cpp
changeset 6225 505643d4c23d
parent 6223 cc3eb9b7230f
child 6616 f77bb02b669f
equal deleted inserted replaced
6223:cc3eb9b7230f 6225:505643d4c23d
    26 #include "team.h"
    26 #include "team.h"
    27 #include "hwform.h"
    27 #include "hwform.h"
    28 #include "hats.h"
    28 #include "hats.h"
    29 
    29 
    30 HWTeam::HWTeam(const QString & teamname) :
    30 HWTeam::HWTeam(const QString & teamname) :
    31 	QObject(0)
    31     QObject(0)
    32 	, m_difficulty(0)
    32     , m_difficulty(0)
    33 	, m_numHedgehogs(4)
    33     , m_numHedgehogs(4)
    34 	, m_isNetTeam(false)
    34     , m_isNetTeam(false)
    35 {
    35 {
    36     m_name = teamname;
    36     m_name = teamname;
    37     OldTeamName = m_name;
    37     OldTeamName = m_name;
    38     for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
    38     for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
    39     {
    39     {
    53     m_wins = 0;
    53     m_wins = 0;
    54     m_campaignProgress = 0;
    54     m_campaignProgress = 0;
    55 }
    55 }
    56 
    56 
    57 HWTeam::HWTeam(const QStringList& strLst) :
    57 HWTeam::HWTeam(const QStringList& strLst) :
    58 	QObject(0)
    58     QObject(0)
    59 	, m_numHedgehogs(4)
    59     , m_numHedgehogs(4)
    60 	, m_isNetTeam(true)
    60     , m_isNetTeam(true)
    61 {
    61 {
    62     // net teams are configured from QStringList
    62     // net teams are configured from QStringList
    63     if(strLst.size() != 23) throw HWTeamConstructException();
    63     if(strLst.size() != 23) throw HWTeamConstructException();
    64     m_name = strLst[0];
    64     m_name = strLst[0];
    65     m_grave = strLst[1];
    65     m_grave = strLst[1];
    80     m_wins = 0;
    80     m_wins = 0;
    81     m_campaignProgress = 0;
    81     m_campaignProgress = 0;
    82 }
    82 }
    83 
    83 
    84 HWTeam::HWTeam() :
    84 HWTeam::HWTeam() :
    85 	QObject(0)
    85     QObject(0)
    86   , m_difficulty(0)
    86   , m_difficulty(0)
    87   , m_numHedgehogs(4)
    87   , m_numHedgehogs(4)
    88   , m_isNetTeam(false)
    88   , m_isNetTeam(false)
    89 {
    89 {
    90     m_name = QString("Team");
    90     m_name = QString("Team");
   108     m_wins = 0;
   108     m_wins = 0;
   109     m_campaignProgress = 0;
   109     m_campaignProgress = 0;
   110 }
   110 }
   111 
   111 
   112 HWTeam::HWTeam(const HWTeam & other) :
   112 HWTeam::HWTeam(const HWTeam & other) :
   113 		QObject(0)
   113         QObject(0)
   114 		, OldTeamName(other.OldTeamName)
   114         , OldTeamName(other.OldTeamName)
   115 		, m_name(other.m_name)
   115         , m_name(other.m_name)
   116 		, m_grave(other.m_grave)
   116         , m_grave(other.m_grave)
   117 		, m_fort(other.m_fort)
   117         , m_fort(other.m_fort)
   118 		, m_flag(other.m_flag)
   118         , m_flag(other.m_flag)
   119 		, m_voicepack(other.m_voicepack)
   119         , m_voicepack(other.m_voicepack)
   120 		, m_hedgehogs(other.m_hedgehogs)
   120         , m_hedgehogs(other.m_hedgehogs)
   121 		, m_difficulty(other.m_difficulty)
   121         , m_difficulty(other.m_difficulty)
   122 		, m_binds(other.m_binds)
   122         , m_binds(other.m_binds)
   123 		, m_numHedgehogs(other.m_numHedgehogs)
   123         , m_numHedgehogs(other.m_numHedgehogs)
   124 		, m_color(other.m_color)
   124         , m_color(other.m_color)
   125 		, m_isNetTeam(other.m_isNetTeam)
   125         , m_isNetTeam(other.m_isNetTeam)
   126 		, m_owner(other.m_owner)
   126         , m_owner(other.m_owner)
   127 		, m_campaignProgress(other.m_campaignProgress)
   127         , m_campaignProgress(other.m_campaignProgress)
   128 		, m_rounds(other.m_rounds)
   128         , m_rounds(other.m_rounds)
   129 		, m_wins(other.m_wins)
   129         , m_wins(other.m_wins)
   130 //	  , AchievementProgress(other.AchievementProgress)
   130 //      , AchievementProgress(other.AchievementProgress)
   131 {
   131 {
   132 
   132 
   133 }
   133 }
   134 
   134 
   135 HWTeam & HWTeam::operator = (const HWTeam & other)
   135 HWTeam & HWTeam::operator = (const HWTeam & other)
   136 {
   136 {
   137 	if(this != &other)
   137     if(this != &other)
   138 	{
   138     {
   139 		OldTeamName = other.OldTeamName;
   139         OldTeamName = other.OldTeamName;
   140 		m_name = other.m_name;
   140         m_name = other.m_name;
   141 		m_grave = other.m_grave;
   141         m_grave = other.m_grave;
   142 		m_fort = other.m_fort;
   142         m_fort = other.m_fort;
   143 		m_flag = other.m_flag;
   143         m_flag = other.m_flag;
   144 		m_voicepack = other.m_voicepack;
   144         m_voicepack = other.m_voicepack;
   145 //		m_hedgehogs = other.m_hedgehogs;
   145 //        m_hedgehogs = other.m_hedgehogs;
   146 		m_difficulty = other.m_difficulty;
   146         m_difficulty = other.m_difficulty;
   147 //		m_binds = other.m_binds;
   147 //        m_binds = other.m_binds;
   148 		m_numHedgehogs = other.m_numHedgehogs;
   148         m_numHedgehogs = other.m_numHedgehogs;
   149 		m_color = other.m_color;
   149         m_color = other.m_color;
   150 		m_isNetTeam = other.m_isNetTeam;
   150         m_isNetTeam = other.m_isNetTeam;
   151 		m_owner = other.m_owner;
   151         m_owner = other.m_owner;
   152 		m_campaignProgress = other.m_campaignProgress;
   152         m_campaignProgress = other.m_campaignProgress;
   153 		m_rounds = other.m_rounds;
   153         m_rounds = other.m_rounds;
   154 		m_wins = other.m_wins;
   154         m_wins = other.m_wins;
   155 	}
   155     }
   156 
   156 
   157 	return *this;
   157     return *this;
   158 }
   158 }
   159 
   159 
   160 bool HWTeam::loadFromFile()
   160 bool HWTeam::loadFromFile()
   161 {
   161 {
   162     QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);
   162     QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0);