239 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick) |
239 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick) |
240 { |
240 { |
241 hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG); |
241 hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG); |
242 connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &))); |
242 connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &))); |
243 connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
243 connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
244 connect(hwnet, SIGNAL(ChangeInTeams(const QStringList &)), this, SLOT(ChangeInNetTeams(const QStringList &))); |
244 connect(hwnet, SIGNAL(AddNetTeam(const QString&)), this, SLOT(AddNetTeam(const QString&))); |
245 |
245 |
246 connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
246 connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
247 |
247 |
248 connect(ui.pageNetGame->pGameCFG, SIGNAL(seedChanged(const QString &)), hwnet, SLOT(onSeedChanged(const QString &))); |
248 connect(ui.pageNetGame->pGameCFG, SIGNAL(seedChanged(const QString &)), hwnet, SLOT(onSeedChanged(const QString &))); |
249 connect(ui.pageNetGame->pGameCFG, SIGNAL(mapChanged(const QString &)), hwnet, SLOT(onMapChanged(const QString &))); |
249 connect(ui.pageNetGame->pGameCFG, SIGNAL(mapChanged(const QString &)), hwnet, SLOT(onMapChanged(const QString &))); |
312 void HWForm::NetStartGame() |
312 void HWForm::NetStartGame() |
313 { |
313 { |
314 hwnet->StartGame(); |
314 hwnet->StartGame(); |
315 } |
315 } |
316 |
316 |
317 void HWForm::ChangeInNetTeams(const QStringList & teams) |
317 void HWForm::AddNetTeam(const QString& team) |
318 { |
318 { |
319 QStringList addedTeams=teams; |
319 ui.pageNetGame->pNetTeamsWidget->addTeam(team, true); |
320 list<HWTeam> lstPlaying=ui.pageNetGame->pNetTeamsWidget->getPlayingTeams(); |
|
321 for(list<HWTeam>::iterator it=lstPlaying.begin(); it!=lstPlaying.end(); ++it) { |
|
322 QString nm=it->TeamName; |
|
323 QStringList::iterator itt=std::find(addedTeams.begin(), addedTeams.end(), nm); |
|
324 if(itt!=addedTeams.end()) addedTeams.erase(itt); |
|
325 } |
|
326 for(QStringList::iterator it=addedTeams.begin(); it!=addedTeams.end(); ++it) { |
|
327 ui.pageNetGame->pNetTeamsWidget->addTeam(*it, true); |
|
328 } |
|
329 |
|
330 /* |
|
331 QStringList lstQSPlaying; |
|
332 std::for_each(lstPlaying.begin(), lstPlaying.end(), lstQSPlaying.push_back); |
|
333 QStringList removedTeams=teams; |
|
334 for(QStringList::iterator it=teams.begin() |
|
335 list<HWTeam>::iterator removedItem=std::find(addedTeams.begin(), addedTeams.end(), nm); |
|
336 */ |
|
337 } |
320 } |
338 |
321 |
339 void HWForm::StartMPGame() |
322 void HWForm::StartMPGame() |
340 { |
323 { |
341 CreateGame(ui.pageMultiplayer->gameCFG); |
324 CreateGame(ui.pageMultiplayer->gameCFG); |