changeset 6223 | cc3eb9b7230f |
parent 6060 | fdfc01419815 |
child 6225 | 505643d4c23d |
6222:96d10dcd6d84 | 6223:cc3eb9b7230f |
---|---|
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 m_difficulty(0), |
31 QObject(0) |
32 m_numHedgehogs(4), |
32 , m_difficulty(0) |
33 m_isNetTeam(false) |
33 , m_numHedgehogs(4) |
34 , m_isNetTeam(false) |
|
34 { |
35 { |
35 m_name = teamname; |
36 m_name = teamname; |
36 OldTeamName = m_name; |
37 OldTeamName = m_name; |
37 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
38 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
38 { |
39 { |
52 m_wins = 0; |
53 m_wins = 0; |
53 m_campaignProgress = 0; |
54 m_campaignProgress = 0; |
54 } |
55 } |
55 |
56 |
56 HWTeam::HWTeam(const QStringList& strLst) : |
57 HWTeam::HWTeam(const QStringList& strLst) : |
57 m_numHedgehogs(4), |
58 QObject(0) |
58 m_isNetTeam(true) |
59 , m_numHedgehogs(4) |
60 , m_isNetTeam(true) |
|
59 { |
61 { |
60 // net teams are configured from QStringList |
62 // net teams are configured from QStringList |
61 if(strLst.size() != 23) throw HWTeamConstructException(); |
63 if(strLst.size() != 23) throw HWTeamConstructException(); |
62 m_name = strLst[0]; |
64 m_name = strLst[0]; |
63 m_grave = strLst[1]; |
65 m_grave = strLst[1]; |
78 m_wins = 0; |
80 m_wins = 0; |
79 m_campaignProgress = 0; |
81 m_campaignProgress = 0; |
80 } |
82 } |
81 |
83 |
82 HWTeam::HWTeam() : |
84 HWTeam::HWTeam() : |
83 m_difficulty(0), |
85 QObject(0) |
84 m_numHedgehogs(4), |
86 , m_difficulty(0) |
85 m_isNetTeam(false) |
87 , m_numHedgehogs(4) |
88 , m_isNetTeam(false) |
|
86 { |
89 { |
87 m_name = QString("Team"); |
90 m_name = QString("Team"); |
88 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
91 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
89 { |
92 { |
90 m_hedgehogs[i].Name.sprintf("hedgehog %d", i); |
93 m_hedgehogs[i].Name.sprintf("hedgehog %d", i); |
104 m_rounds = 0; |
107 m_rounds = 0; |
105 m_wins = 0; |
108 m_wins = 0; |
106 m_campaignProgress = 0; |
109 m_campaignProgress = 0; |
107 } |
110 } |
108 |
111 |
112 HWTeam::HWTeam(const HWTeam & other) : |
|
113 QObject(0) |
|
114 , OldTeamName(other.OldTeamName) |
|
115 , m_name(other.m_name) |
|
116 , m_grave(other.m_grave) |
|
117 , m_fort(other.m_fort) |
|
118 , m_flag(other.m_flag) |
|
119 , m_voicepack(other.m_voicepack) |
|
120 , m_hedgehogs(other.m_hedgehogs) |
|
121 , m_difficulty(other.m_difficulty) |
|
122 , m_binds(other.m_binds) |
|
123 , m_numHedgehogs(other.m_numHedgehogs) |
|
124 , m_color(other.m_color) |
|
125 , m_isNetTeam(other.m_isNetTeam) |
|
126 , m_owner(other.m_owner) |
|
127 , m_campaignProgress(other.m_campaignProgress) |
|
128 , m_rounds(other.m_rounds) |
|
129 , m_wins(other.m_wins) |
|
130 // , AchievementProgress(other.AchievementProgress) |
|
131 { |
|
132 |
|
133 } |
|
134 |
|
135 HWTeam & HWTeam::operator = (const HWTeam & other) |
|
136 { |
|
137 if(this != &other) |
|
138 { |
|
139 OldTeamName = other.OldTeamName; |
|
140 m_name = other.m_name; |
|
141 m_grave = other.m_grave; |
|
142 m_fort = other.m_fort; |
|
143 m_flag = other.m_flag; |
|
144 m_voicepack = other.m_voicepack; |
|
145 // m_hedgehogs = other.m_hedgehogs; |
|
146 m_difficulty = other.m_difficulty; |
|
147 // m_binds = other.m_binds; |
|
148 m_numHedgehogs = other.m_numHedgehogs; |
|
149 m_color = other.m_color; |
|
150 m_isNetTeam = other.m_isNetTeam; |
|
151 m_owner = other.m_owner; |
|
152 m_campaignProgress = other.m_campaignProgress; |
|
153 m_rounds = other.m_rounds; |
|
154 m_wins = other.m_wins; |
|
155 } |
|
156 |
|
157 return *this; |
|
158 } |
|
109 |
159 |
110 bool HWTeam::loadFromFile() |
160 bool HWTeam::loadFromFile() |
111 { |
161 { |
112 QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0); |
162 QSettings teamfile(cfgdir->absolutePath() + "/Teams/" + m_name + ".hwt", QSettings::IniFormat, 0); |
113 teamfile.setIniCodec("UTF-8"); |
163 teamfile.setIniCodec("UTF-8"); |