345 if (lst[1] == "AMMO") { |
343 if (lst[1] == "AMMO") { |
346 if(lst.size() < 4) return; |
344 if(lst.size() < 4) return; |
347 emit ammoChanged(lst[3], lst[2]); |
345 emit ammoChanged(lst[3], lst[2]); |
348 return; |
346 return; |
349 } |
347 } |
350 QStringList hhTmpList=lst[1].split('+'); |
348 QStringList hhTmpList = lst[1].split('+'); |
351 if (hhTmpList[0] == "TEAM_COLOR") { |
349 if (hhTmpList[0] == "TEAM_COLOR") { |
352 HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt()); |
350 HWTeam tmptm(hhTmpList[1]); |
353 if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) { |
351 tmptm.teamColor = QColor(lst[2]); |
354 tmptm=HWTeam(hhTmpList[1]); // local team should be changed |
|
355 } |
|
356 tmptm.teamColor=QColor(lst[2]); |
|
357 emit teamColorChanged(tmptm); |
352 emit teamColorChanged(tmptm); |
358 return; |
353 return; |
359 } |
354 } |
360 if (hhTmpList[0] == "HHNUM") { |
355 if (hhTmpList[0] == "HHNUM") { |
361 HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt()); |
356 HWTeam tmptm(hhTmpList[1]); |
362 if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) { |
357 tmptm.numHedgehogs = lst[2].toUInt(); |
363 tmptm=HWTeam(hhTmpList[1]); // local team should be changed |
|
364 } |
|
365 tmptm.numHedgehogs=lst[2].toUInt(); |
|
366 emit hhnumChanged(tmptm); |
358 emit hhnumChanged(tmptm); |
367 return; |
359 return; |
368 } |
360 } |
369 qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst; |
361 qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst; |
370 return; |
362 return; |
408 emit AskForRunGame(); |
400 emit AskForRunGame(); |
409 } |
401 } |
410 |
402 |
411 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team) |
403 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team) |
412 { |
404 { |
413 RawSendNet(QString("HHNUM%1%2%1%3%1%4").arg(delimeter).arg(team.TeamName) |
405 RawSendNet(QString("HHNUM%1%2%1%3") |
414 .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName)) |
406 .arg(delimeter) |
|
407 .arg(team.TeamName) |
415 .arg(team.numHedgehogs)); |
408 .arg(team.numHedgehogs)); |
416 } |
409 } |
417 |
410 |
418 void HWNewNet::onTeamColorChanged(const HWTeam& team) |
411 void HWNewNet::onTeamColorChanged(const HWTeam& team) |
419 { |
412 { |
420 RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR+%2+%3%1%4").arg(delimeter).arg(team.TeamName) |
413 RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3") |
421 .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName)) |
414 .arg(delimeter) |
|
415 .arg(team.TeamName) |
422 .arg(team.teamColor.name())); |
416 .arg(team.teamColor.name())); |
423 } |
417 } |
424 |
418 |
425 void HWNewNet::onSeedChanged(const QString & seed) |
419 void HWNewNet::onSeedChanged(const QString & seed) |
426 { |
420 { |