48 binds[i].strbind = cbinds[i].strbind; |
48 binds[i].strbind = cbinds[i].strbind; |
49 } |
49 } |
50 } |
50 } |
51 |
51 |
52 HWTeam::HWTeam(const QStringList& strLst) : |
52 HWTeam::HWTeam(const QStringList& strLst) : |
53 numHedgehogs(4) |
53 numHedgehogs(4), |
|
54 m_isNetTeam(true) |
54 { |
55 { |
55 // net teams are configured from QStringList |
56 // net teams are configured from QStringList |
56 if(strLst.size() < 21) throw HWTeamConstructException(); |
57 if(strLst.size() < 20) throw HWTeamConstructException(); |
57 TeamName=strLst[0]; |
58 TeamName = strLst[0]; |
58 m_netID=strLst[1].toUInt(); |
59 Grave = strLst[1]; |
59 Grave=strLst[2]; |
60 Fort = strLst[2]; |
60 Fort=strLst[3]; |
61 difficulty = strLst[3].toUInt(); |
61 difficulty=strLst[4].toUInt(); |
|
62 for(int i = 0; i < 8; i++) |
62 for(int i = 0; i < 8; i++) |
63 { |
63 { |
64 HHName[i]=strLst[i * 2 + 5]; |
64 HHName[i]=strLst[i * 2 + 4]; |
65 HHHat[i]=strLst[i * 2 + 6]; |
65 HHHat[i]=strLst[i * 2 + 5]; |
66 } |
66 } |
67 } |
67 } |
68 |
68 |
69 HWTeam::HWTeam(quint8 num) : |
69 HWTeam::HWTeam(quint8 num) : |
70 difficulty(0), |
70 difficulty(0), |
71 numHedgehogs(4), |
71 numHedgehogs(4), |
72 m_netID(0) |
72 m_isNetTeam(false) |
73 { |
73 { |
74 num %= PREDEFTEAMS_COUNT; |
74 num %= PREDEFTEAMS_COUNT; |
75 TeamName = QApplication::translate("teams", pteams[num].TeamName); |
75 TeamName = QApplication::translate("teams", pteams[num].TeamName); |
76 HHName[0] = QApplication::translate("teams", pteams[num].hh0name); |
76 HHName[0] = QApplication::translate("teams", pteams[num].hh0name); |
77 HHName[1] = QApplication::translate("teams", pteams[num].hh1name); |
77 HHName[1] = QApplication::translate("teams", pteams[num].hh1name); |
240 QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const |
240 QStringList HWTeam::TeamGameConfig(quint32 InitHealth) const |
241 { |
241 { |
242 QStringList sl; |
242 QStringList sl; |
243 sl.push_back(QString("eaddteam %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName)); |
243 sl.push_back(QString("eaddteam %1 %2").arg(teamColor.rgb() & 0xffffff).arg(TeamName)); |
244 |
244 |
245 if (m_netID) |
245 if (m_isNetTeam) |
246 sl.push_back("erdriven"); |
246 sl.push_back("erdriven"); |
247 |
247 |
248 sl.push_back(QString("egrave " + Grave)); |
248 sl.push_back(QString("egrave " + Grave)); |
249 sl.push_back(QString("efort " + Fort)); |
249 sl.push_back(QString("efort " + Fort)); |
250 |
250 |
251 if (!m_netID) |
251 if (!m_isNetTeam) |
252 for(int i = 0; i < BINDS_NUMBER; i++) |
252 for(int i = 0; i < BINDS_NUMBER; i++) |
253 sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action)); |
253 sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action)); |
254 |
254 |
255 for (int t = 0; t < numHedgehogs; t++) |
255 for (int t = 0; t < numHedgehogs; t++) |
256 { |
256 { |
264 return sl; |
264 return sl; |
265 } |
265 } |
266 |
266 |
267 bool HWTeam::isNetTeam() const |
267 bool HWTeam::isNetTeam() const |
268 { |
268 { |
269 return m_netID!=0; |
269 return m_isNetTeam; |
270 } |
270 } |
271 |
271 |
272 unsigned int HWTeam::getNetID() const |
|
273 { |
|
274 return m_netID; |
|
275 } |
|
276 |
272 |
277 bool HWTeam::operator==(const HWTeam& t1) const { |
273 bool HWTeam::operator==(const HWTeam& t1) const { |
278 return TeamName==t1.TeamName && m_netID==t1.m_netID; |
274 return TeamName==t1.TeamName; |
279 } |
275 } |
280 |
276 |
281 bool HWTeam::operator<(const HWTeam& t1) const { |
277 bool HWTeam::operator<(const HWTeam& t1) const { |
282 return m_netID<t1.m_netID || TeamName<t1.TeamName; // if names are equal - test if it is net team |
278 return TeamName<t1.TeamName; // if names are equal - test if it is net team |
283 } |
279 } |