QTfrontend/newnetclient.cpp
changeset 399 c7da1bd32b4e
parent 396 70dfd02845af
child 401 bcebe3921740
equal deleted inserted replaced
398:fd2cf7827f31 399:c7da1bd32b4e
   225   	}
   225   	}
   226   	if (lst[1] == "FORTSMODE") {
   226   	if (lst[1] == "FORTSMODE") {
   227 	  emit fortsModeChanged(lst[2].toInt() != 0);
   227 	  emit fortsModeChanged(lst[2].toInt() != 0);
   228 	  return;
   228 	  return;
   229   	}
   229   	}
   230   	if (lst[1] == "HHNUM") {
       
   231 	  HWTeam tmptm(lst[2], lst[3].toUInt());
       
   232 	  if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) {
       
   233 	    tmptm=HWTeam(lst[2]); // local team should be changed
       
   234 	  }
       
   235 	  tmptm.numHedgehogs=lst[4].toUInt();
       
   236 	  emit hhnumChanged(tmptm);
       
   237 	  return;
       
   238   	}
       
   239   	if (lst[1] == "TEAM_COLOR") {
   230   	if (lst[1] == "TEAM_COLOR") {
   240 	  HWTeam tmptm(lst[2], lst[3].toUInt());
   231 	  HWTeam tmptm(lst[2], lst[3].toUInt());
   241 	  if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) {
   232 	  if(m_networkToLocalteams.find(lst[3].toUInt())!=m_networkToLocalteams.end()) {
   242 	    tmptm=HWTeam(lst[2]); // local team should be changed
   233 	    tmptm=HWTeam(lst[2]); // local team should be changed
   243 	  }
   234 	  }
   244 	  tmptm.teamColor=QColor(lst[4]);
   235 	  tmptm.teamColor=QColor(lst[4]);
   245 	  emit teamColorChanged(tmptm);
   236 	  emit teamColorChanged(tmptm);
   246 	  return;
   237 	  return;
   247   	}
   238   	}
       
   239 	QStringList hhTmpList;
       
   240   	if ((hhTmpList=lst[1].split('+'))[0] == "HHNUM") {
       
   241 	  qDebug() << "NEW HHNUM!";
       
   242 	  HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
       
   243 	  if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
       
   244 	    tmptm=HWTeam(hhTmpList[1]); // local team should be changed
       
   245 	  }
       
   246 	  tmptm.numHedgehogs=lst[2].toUInt();
       
   247 	  emit hhnumChanged(tmptm);
       
   248 	  return;
       
   249   	}
   248   	qDebug() << "unknow config param: " << lst[1];
   250   	qDebug() << "unknow config param: " << lst[1];
   249     return;
   251     return;
   250   }
   252   }
   251 
   253 
   252 
   254 
   282 }
   284 }
   283 
   285 
   284 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team)
   286 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team)
   285 {
   287 {
   286   qDebug() << team.getNetID() << ":" << team.numHedgehogs;
   288   qDebug() << team.getNetID() << ":" << team.numHedgehogs;
   287   RawSendNet(QString("CONFIG_PARAM%1HHNUM%1%2%1%3%1%4").arg(delimeter).arg(team.TeamName)\
   289   RawSendNet(QString("CONFIG_PARAM%1HHNUM+%2+%3%1%4").arg(delimeter).arg(team.TeamName)\
   288 	     .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))\
   290 	     .arg(team.getNetID() ? team.getNetID() : m_networkToLocalteams.key(team.TeamName))\
   289 	     .arg(team.numHedgehogs));
   291 	     .arg(team.numHedgehogs));
   290 }
   292 }
   291 
   293 
   292 void HWNewNet::onTeamColorChanged(const HWTeam& team)
   294 void HWNewNet::onTeamColorChanged(const HWTeam& team)