70 } |
70 } |
71 |
71 |
72 void HWNewNet::RemoveTeam(const HWTeam & team) |
72 void HWNewNet::RemoveTeam(const HWTeam & team) |
73 { |
73 { |
74 RawSendNet(QString("REMOVETEAM:") + delimeter + team.TeamName); |
74 RawSendNet(QString("REMOVETEAM:") + delimeter + team.TeamName); |
|
75 m_networkToLocalteams.remove(m_networkToLocalteams.key(team.TeamName)); |
75 } |
76 } |
76 |
77 |
77 void HWNewNet::StartGame() |
78 void HWNewNet::StartGame() |
78 { |
79 { |
79 RawSendNet(QString("START:")); |
80 RawSendNet(QString("START:")); |
195 //emit fortsModeChanged(lst[5].toInt() != 0); // FIXME: add a getFortsMode in ConfigAsked |
196 //emit fortsModeChanged(lst[5].toInt() != 0); // FIXME: add a getFortsMode in ConfigAsked |
196 return; |
197 return; |
197 } |
198 } |
198 |
199 |
199 if(lst[0]=="TEAM_ACCEPTED") { |
200 if(lst[0]=="TEAM_ACCEPTED") { |
|
201 qDebug() << "accepted " << lst[2].toUInt() << " team"; |
200 m_networkToLocalteams.insert(lst[2].toUInt(), lst[1]); |
202 m_networkToLocalteams.insert(lst[2].toUInt(), lst[1]); |
201 m_pTeamSelWidget->changeTeamStatus(lst[1]); |
203 m_pTeamSelWidget->changeTeamStatus(lst[1]); |
202 return; |
204 return; |
203 } |
205 } |
204 |
206 |
225 } |
227 } |
226 if (lst[1] == "FORTSMODE") { |
228 if (lst[1] == "FORTSMODE") { |
227 emit fortsModeChanged(lst[2].toInt() != 0); |
229 emit fortsModeChanged(lst[2].toInt() != 0); |
228 return; |
230 return; |
229 } |
231 } |
230 if (lst[1] == "TEAM_COLOR") { |
232 QStringList hhTmpList=lst[1].split('+'); |
231 HWTeam tmptm(lst[2], lst[3].toUInt()); |
233 if (hhTmpList[0] == "TEAM_COLOR") { |
232 if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) { |
234 HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt()); |
233 tmptm=HWTeam(lst[2]); // local team should be changed |
235 if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) { |
|
236 tmptm=HWTeam(hhTmpList[1]); // local team should be changed |
234 } |
237 } |
235 tmptm.teamColor=QColor(lst[4]); |
238 tmptm.teamColor=QColor(lst[2]); |
236 emit teamColorChanged(tmptm); |
239 emit teamColorChanged(tmptm); |
237 return; |
240 return; |
238 } |
241 } |
239 QStringList hhTmpList; |
242 if (hhTmpList[0] == "HHNUM") { |
240 if ((hhTmpList=lst[1].split('+'))[0] == "HHNUM") { |
|
241 qDebug() << "NEW HHNUM!"; |
243 qDebug() << "NEW HHNUM!"; |
242 HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt()); |
244 HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt()); |
243 if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) { |
245 if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) { |
244 tmptm=HWTeam(hhTmpList[1]); // local team should be changed |
246 tmptm=HWTeam(hhTmpList[1]); // local team should be changed |
245 } |
247 } |
292 } |
294 } |
293 |
295 |
294 void HWNewNet::onTeamColorChanged(const HWTeam& team) |
296 void HWNewNet::onTeamColorChanged(const HWTeam& team) |
295 { |
297 { |
296 qDebug() << team.getNetID() << ":" << team.teamColor.name(); |
298 qDebug() << team.getNetID() << ":" << team.teamColor.name(); |
297 RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3%1%4").arg(delimeter).arg(team.TeamName)\ |
299 RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR+%2+%3%1%4").arg(delimeter).arg(team.TeamName)\ |
298 .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))\ |
300 .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))\ |
299 .arg(team.teamColor.name())); |
301 .arg(team.teamColor.name())); |
300 } |
302 } |
301 |
303 |
302 void HWNewNet::onSeedChanged(const QString & seed) |
304 void HWNewNet::onSeedChanged(const QString & seed) |